Exemplo n.º 1
0
func printDefaultConfig() {
	cfg, _ := config.LoadFromBytes(nil)
	data, _ := json.MarshalIndent(cfg, "", "    ")
	fmt.Print(string(data))
	fmt.Print("\n")
	os.Exit(0)
}
Exemplo n.º 2
0
func TestLoadSomeConfigValues(t *testing.T) {
	c, err := config.LoadFromBytes([]byte(`{"Door":{"Pins":{"SenseUnlocked":99}}}`))
	if err != nil {
		t.Error(err)
	}
	if c.Door.Pins.SenseUnlocked != 99 {
		t.Errorf("Door.Pins.SenseUnlocked was not updated")
	}
}
Exemplo n.º 3
0
func TestDefaultConfig(t *testing.T) {
	c, err := config.LoadFromBytes([]byte("{}"))
	if err != nil {
		t.Error(err)
	}
	if c.Web.TLS != nil {
		t.Error("TLS should not be configured by default")
	}
	t.Logf("%#v", c)
}