tplinkcmd/cmd/tpapi/config.go
2022-01-08 11:40:11 -06:00

48 lines
1.1 KiB
Go

package main
import (
"os"
"time"
"github.com/hashicorp/logutils"
"github.com/prometheus/client_golang/prometheus"
)
type configStructure struct {
// time configuration
TimeFormat string `json:"time_format"`
TimeZone *time.Location
TimeZoneUTC *time.Location
// logging
LogLevel int `json:"log_level"`
Log *logutils.LevelFilter `json:"log_level_fileter"`
// webserver
WebSrvPort int `json:"webserver_port"`
WebSrvIP string `json:"webserver_ip"`
WebSrvReadTimeout int `json:"webserver_read_timeout"`
WebSrvWriteTimeout int `json:"webserver_write_timeout"`
WebSrvIdleTimeout int `json:"webserver_idle_timeout"`
// prometheus
Prometheus configPrometheus
}
type configPrometheus struct {
NumGroupCreated prometheus.Gauge
NumGroupChanged prometheus.Gauge
NumGroupDeleted prometheus.Gauge
}
var config = configStructure{
TimeFormat: "2006-01-02 15:04:05",
Log: &logutils.LevelFilter{
Levels: []logutils.LogLevel{"TRACE", "DEBUG", "INFO", "WARNING", "ERROR"},
Writer: os.Stderr,
},
WebSrvReadTimeout: 2,
WebSrvWriteTimeout: 10,
WebSrvIdleTimeout: 2,
}