30 lines
682 B
Go
30 lines
682 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func SetDefaultConfig(v *viper.Viper) {
|
|
v.SetDefault("TH7.port", 8080)
|
|
v.SetDefault("TH7.cache", true)
|
|
v.SetDefault("TH7.LED", true)
|
|
v.SetDefault("TH7.debug", false)
|
|
v.SetDefault("TH7.nolog", false)
|
|
v.SetDefault("TH7.noweb", false)
|
|
v.SetDefault("DB.freq", 600)
|
|
|
|
// set defaults for channels
|
|
for i := 1; i < 8; i++ {
|
|
var head = fmt.Sprintf("Channel_%d", i)
|
|
v.SetDefault(head+".type", "NOTSET")
|
|
v.SetDefault(head+".gain", 106.8)
|
|
v.SetDefault(head+".offset", 0.0)
|
|
v.SetDefault(head+".log", true)
|
|
// filter settings
|
|
v.SetDefault(head+".filter.samples", 50)
|
|
v.SetDefault(head+".filter.type", 0)
|
|
}
|
|
}
|