The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/services/grafana-apiserver/config.go

38 lines
931 B

package grafanaapiserver
import (
"fmt"
"path/filepath"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/setting"
)
type config struct {
enabled bool
devMode bool
host string
appURL string
etcdServers []string
dataPath string
logLevel int
}
func newConfig(cfg *setting.Cfg) *config {
defaultLogLevel := 0
if cfg.Env == setting.Dev {
defaultLogLevel = 10
}
return &config{
enabled: cfg.IsFeatureToggleEnabled(featuremgmt.FlagGrafanaAPIServer),
devMode: cfg.Env == setting.Dev,
dataPath: filepath.Join(cfg.DataPath, "grafana-apiserver"),
host: fmt.Sprintf("%s:%s", cfg.HTTPAddr, cfg.HTTPPort),
logLevel: cfg.SectionWithEnvOverrides("grafana-apiserver").Key("log_level").MustInt(defaultLogLevel),
etcdServers: cfg.SectionWithEnvOverrides("grafana-apiserver").Key("etcd_servers").Strings(","),
appURL: cfg.AppURL,
}
}