mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-08 05:11:56 -05:00
49 lines
1.0 KiB
Go
49 lines
1.0 KiB
Go
package defaults
|
|
|
|
import (
|
|
"github.com/opencloud-eu/opencloud/services/audit/pkg/config"
|
|
)
|
|
|
|
// FullDefaultConfig returns a fully initialized default configuration
|
|
func FullDefaultConfig() *config.Config {
|
|
cfg := DefaultConfig()
|
|
EnsureDefaults(cfg)
|
|
Sanitize(cfg)
|
|
return cfg
|
|
}
|
|
|
|
// DefaultConfig returns a basic default configuration
|
|
func DefaultConfig() *config.Config {
|
|
return &config.Config{
|
|
Debug: config.Debug{
|
|
Addr: "127.0.0.1:9229",
|
|
Zpages: false,
|
|
Pprof: false,
|
|
},
|
|
Service: config.Service{
|
|
Name: "audit",
|
|
},
|
|
Events: config.Events{
|
|
Endpoint: "127.0.0.1:9233",
|
|
Cluster: "opencloud-cluster",
|
|
EnableTLS: false,
|
|
},
|
|
Auditlog: config.Auditlog{
|
|
LogToConsole: true,
|
|
Format: "json",
|
|
},
|
|
}
|
|
}
|
|
|
|
// EnsureDefaults adds default values to the configuration if they are not set yet
|
|
func EnsureDefaults(cfg *config.Config) {
|
|
if cfg.LogLevel == "" {
|
|
cfg.LogLevel = "error"
|
|
}
|
|
}
|
|
|
|
// Sanitize sanitized the configuration
|
|
func Sanitize(cfg *config.Config) {
|
|
// sanitize config
|
|
}
|