From 64ff7e0749187d21a5212f0d8c10e9fed6869eac Mon Sep 17 00:00:00 2001 From: Bora Alper Date: Wed, 15 Nov 2017 00:25:32 +0000 Subject: [PATCH] Made database cmdline arg optional again, fixed appveyor.yml --- appveyor.yml | 12 +++++++++--- magneticod/main.go | 9 +++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 846a748..c5100b6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,10 +7,10 @@ branches: - go-rewrite # Source Config -clone_folder: c:\gopath\src\github.com\boramalper\magnetico +clone_folder: c:\gopath\src\magnetico +shallow_clone: true # Build host - environment: GOPATH: c:\gopath GOVERSION: 1.9.2 @@ -25,4 +25,10 @@ install: - go env build_script: - - go install github.com/magnetico/magneticod + - go install magnetico/magneticod + - go install magnetico/magneticow + +test_script: + - go test -cover magnetico/magneticod/... + - go test -cover magnetico/magneticow/... + - go test -cover magnetico/persistence/... diff --git a/magneticod/main.go b/magneticod/main.go index 8d6e981..5c1ae5a 100644 --- a/magneticod/main.go +++ b/magneticod/main.go @@ -17,10 +17,12 @@ import ( "magnetico/persistence" "runtime/pprof" + "github.com/Wessie/appdirs" + "path" ) type cmdFlags struct { - DatabaseURL string `long:"database" description:"URL of the database." required:"yeah"` + DatabaseURL string `long:"database" description:"URL of the database."` TrawlerMlAddrs []string `long:"trawler-ml-addr" description:"Address(es) to be used by trawling DHT (Mainline) nodes." default:"0.0.0.0:0"` TrawlerMlInterval uint `long:"trawler-ml-interval" description:"Trawling interval in integer deciseconds (one tenth of a second)."` @@ -142,7 +144,10 @@ func parseFlags() (*opFlags, error) { } if cmdF.DatabaseURL == "" { - zap.S().Fatal("database") + opF.DatabaseURL = "sqlite3://" + path.Join( + appdirs.UserDataDir("magneticod", "", "", false), + "database.sqlite3", + ) } else { opF.DatabaseURL = cmdF.DatabaseURL }