tplinkcmd/cmd/tpstate/config.go
2021-12-04 10:15:16 -06:00

42 lines
995 B
Go

package main
import (
"os"
"time"
"github.com/hashicorp/logutils"
"github.com/kelvins/sunrisesunset"
)
type configStructure struct {
// time configuration
TimeFormat string `json:"time_format"`
TimeZone *time.Location `json:"time_zone"`
// logging
LogLevel int `json:"log_level"`
Log *logutils.LevelFilter `json:"log_level_fileter"`
//sunriseset configuration
SunRiseSet *sunrisesunset.Parameters `json:"sun_rise_set_configuration"`
// mode of operation
CalculateDate time.Time `json:"sunrise_sunset_calculation_date"`
SecondsUntil bool `json:"seconds_until"`
NextSunriseSunset bool `json:"next_sunrise_sunset"`
}
// Set Defaults
var config = configStructure{
LogLevel: 50,
TimeFormat: "2006-01-02 15:04:05",
Log: &logutils.LevelFilter{
Levels: []logutils.LogLevel{"TRACE", "DEBUG", "INFO", "WARNING", "ERROR"},
Writer: os.Stderr,
},
SunRiseSet: &sunrisesunset.Parameters{
Latitude: 38.749020,
Longitude: -90.521360,
},
}