Skip to content

Commit 17ad550

Browse files
committed
Make the indexurl configurable
1 parent fd7c422 commit 17ad550

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
portSSL string
4546
origins = flag.String("origins", "", "Allowed origin list for CORS")
4647
address = flag.String("address", "127.0.0.1", "The address where to listen. Defaults to localhost")
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
Tools tools.Tools
4850
)
4951

@@ -88,9 +90,11 @@ func main() {
8890
dest := filepath.Dir(src)
8991

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

0 commit comments

Comments
 (0)