Skip to content

Commit

Permalink
Added extra config location - /config/
Browse files Browse the repository at this point in the history
  • Loading branch information
toxuin committed May 21, 2022
1 parent b88cd11 commit a5e7f16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ _A_: Some IP cameras have ONVIF, and sometimes that even includes motion alarms,

- Misecu 5MP Wifi AI Cam (Hisilicon server)

- HomeViz OB10, K4W10, OW10 (Hisilicon server, tested by [acburnett](https://github.com/acburnett))

If your camera works with Alarm Server - create an issue with some details about it and a picture, and we'll post it here.

## Docker
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (c *Config) SetDefaults() {
viper.SetConfigName("config")
viper.SetConfigType("yaml")
viper.AddConfigPath(".")
viper.AddConfigPath("./config/")

viper.SetDefault("debug", false)
viper.SetDefault("mqtt.port", 1883)
Expand Down Expand Up @@ -86,6 +87,7 @@ func (c *Config) SetDefaults() {
err := viper.ReadInConfig()
if err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
fmt.Println("Config file not found, writing default config...")
err := viper.SafeWriteConfig()
if err != nil {
panic(fmt.Errorf("error saving default config file: %s \n", err))
Expand Down

0 comments on commit a5e7f16

Please sign in to comment.