()
| 206 | } |
| 207 | |
| 208 | func main() { |
| 209 | log.Println("Starting the Bytesized Connect Daemon", core.VerString) |
| 210 | |
| 211 | switch kingpin.MustParse(app.Parse(os.Args[1:])) { |
| 212 | case register.FullCommand(): |
| 213 | log.Infoln("Initialization run, writing config file.") |
| 214 | c := core.MainConfig{ApiSecret: *apisecret, ApiKey: *apikey, Port: *port} |
| 215 | err := core.WriteConfig("config.json", &c) |
| 216 | if err != nil { |
| 217 | log.Panicf("Could not write config file: '%s'", err.Error()) |
| 218 | } |
| 219 | log.Infoln("Initialization run completed, please start the daemon normally.") |
| 220 | case start.FullCommand(): |
| 221 | c := core.MainConfig{} |
| 222 | c.Port = *port |
| 223 | err := core.LoadHomeConfig("config.json", &c) |
| 224 | |
| 225 | if err != nil { |
| 226 | log.Info("Could not load config file. Please run with '-init APIKEY APISECRET' first.", err.Error()) |
| 227 | os.Exit(1) |
| 228 | } |
| 229 | |
| 230 | log.Debugf("Using docker socket '%s'", *endpoint) |
| 231 | startApp(&c) |
| 232 | } |
| 233 | |
| 234 | } |
nothing calls this directly
no test coverage detected