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