initial commit
This commit is contained in:
41
cmd/tpstate/config.go
Normal file
41
cmd/tpstate/config.go
Normal file
@@ -0,0 +1,41 @@
|
||||
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,
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user