Skip to content

Commit aba9bc6

Browse files
committed
Make the indexurl configurable
1 parent eb6fc1f commit aba9bc6

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"
@@ -46,6 +47,7 @@ var (
4647
portSSL string
4748
origins = flag.String("origins", "", "Allowed origin list for CORS")
4849
address = flag.String("address", "127.0.0.1", "The address where to listen. Defaults to localhost")
50+
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")
4951
Tools tools.Tools
5052
)
5153

@@ -90,9 +92,11 @@ func main() {
9092
dest := filepath.Dir(src)
9193

9294
// Instantiate Tools
95+
usr, _ := user.Current()
96+
directory := usr.HomeDir + "/.arduino-create"
9397
Tools = tools.Tools{
94-
Directory: "/home/user/.arduino-create",
95-
IndexURL: "http://downloads.arduino.cc/packages/package_index.json",
98+
Directory: directory,
99+
IndexURL: *indexURL,
96100
Logger: log.New(),
97101
}
98102
Tools.Init()

0 commit comments

Comments
 (0)