예제 #1
0
func init() {
	logs.Init(Debug)

	fmt.Println("Reading config...")
	if err := router.Init("../data/config.json"); err != nil {
		fmt.Errorf("Init() failed: %s", err)
	}
}
예제 #2
0
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))

}
예제 #3
0
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()
}