func init() { logs.Init(Debug) fmt.Println("Reading config...") if err := router.Init("../data/config.json"); err != nil { fmt.Errorf("Init() failed: %s", err) } }
func TestReadConfig(t *testing.T) { fmt.Println("\n\n\n\n============================= [TestReadConfig] =============================") logs.Init(true) if err := Init("../data/config.json"); err != nil { t.Errorf("Init() failed: %s", err) } fmt.Printf("\n-------------------- ADAPTERS ------------------\n%s", adapters) if adapters.loaded != true { t.Errorf("Site configuration is not marked as loaded.") } fmt.Println(spew.Sdump(adapters)) }
func init() { var configFile string flag.BoolVar(&Debug, "debug", false, "Activates debug logging.") flag.StringVar(&configFile, "config", "data/config.json", "Config file. This is a full or relative path.") flag.Parse() logs.Init(Debug) if err := router.Init(configFile); err != nil { log.Fatal("Unable to start - data initilization failed.\n") } go signalHandler(make(chan os.Signal, 1)) fmt.Println("Press Ctrl-C to shutdown...") time.Sleep(time.Second * 2) services.Refresh() }