Skip to content

Commit c9c32a9

Browse files
committed
Make the indexurl configurable
1 parent c00e740 commit c9c32a9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package main
66
import (
77
"flag"
88
"os"
9+
"os/user"
910
"path/filepath"
1011
"runtime/debug"
1112
"strconv"
@@ -44,6 +45,7 @@ var (
4445
address = flag.String("address", "127.0.0.1", "The address where to listen. Defaults to localhost")
4546
signatureKey = flag.String("signatureKey", "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvc0yZr1yUSen7qmE3cxF\nIE12rCksDnqR+Hp7o0nGi9123eCSFcJ7CkIRC8F+8JMhgI3zNqn4cUEn47I3RKD1\nZChPUCMiJCvbLbloxfdJrUi7gcSgUXrlKQStOKF5Iz7xv1M4XOP3JtjXLGo3EnJ1\npFgdWTOyoSrA8/w1rck4c/ISXZSinVAggPxmLwVEAAln6Itj6giIZHKvA2fL2o8z\nCeK057Lu8X6u2CG8tRWSQzVoKIQw/PKK6CNXCAy8vo4EkXudRutnEYHEJlPkVgPn\n2qP06GI+I+9zKE37iqj0k1/wFaCVXHXIvn06YrmjQw6I0dDj/60Wvi500FuRVpn9\ntwIDAQAB\n-----END PUBLIC KEY-----", "Pem-encoded public key to verify signed commandlines")
4647
Tools tools.Tools
48+
indexURL = flag.String("indexURL", "http://downloads.arduino.cc/packages/package_index.json", "The address from where to download the index json containing the location of upload tools")
4749
)
4850

4951
type NullWriter int
@@ -87,9 +89,11 @@ func main() {
8789
dest := filepath.Dir(src)
8890

8991
// Instantiate Tools
92+
usr, _ := user.Current()
93+
directory := usr.HomeDir + "/.arduino-create"
9094
Tools = tools.Tools{
91-
Directory: "/home/user/.arduino-create",
92-
IndexURL: "http://downloads.arduino.cc/packages/package_index.json",
95+
Directory: directory,
96+
IndexURL: *indexURL,
9397
Logger: log.New(),
9498
}
9599
Tools.Init()

0 commit comments

Comments
 (0)