root: config: remove redundant default configs

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2023-04-29 00:58:44 +02:00
parent 4e1d8543e3
commit 2a15004232
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
2 changed files with 8 additions and 24 deletions

View File

@ -11,7 +11,11 @@ postgresql:
listen:
listen_http: 0.0.0.0:9000
listen_https: 0.0.0.0:9443
listen_ldap: 0.0.0.0:3389
listen_ldaps: 0.0.0.0:6636
listen_radius: 0.0.0.0:1812
listen_metrics: 0.0.0.0:9300
listen_debug: 0.0.0.0:9900
redis:
host: localhost
@ -25,6 +29,9 @@ redis:
cache_timeout_policies: 300
cache_timeout_reputation: 300
paths:
media: ./media
debug: false
log_level: info

View File

@ -55,36 +55,13 @@ func getConfigPaths() []string {
func Get() *Config {
if cfg == nil {
c := defaultConfig()
c := &Config{}
c.Setup(getConfigPaths()...)
cfg = c
}
return cfg
}
func defaultConfig() *Config {
return &Config{
Debug: false,
Listen: ListenConfig{
HTTP: "0.0.0.0:9000",
HTTPS: "0.0.0.0:9443",
LDAP: "0.0.0.0:3389",
LDAPS: "0.0.0.0:6636",
Radius: "0.0.0.0:1812",
Metrics: "0.0.0.0:9300",
Debug: "0.0.0.0:9900",
},
Paths: PathsConfig{
Media: "./media",
},
LogLevel: "info",
ErrorReporting: ErrorReportingConfig{
Enabled: false,
SampleRate: 1,
},
}
}
func (c *Config) Setup(paths ...string) {
for _, path := range paths {
err := c.LoadConfig(path)