func printDefaultConfig() { cfg, _ := config.LoadFromBytes(nil) data, _ := json.MarshalIndent(cfg, "", " ") fmt.Print(string(data)) fmt.Print("\n") os.Exit(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") } }
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) }