mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
3c81e75d79
This adds an access-control command that checks the policy enforcement for a given criteria using a configuration file and refactors the configuration validation command to include all configuration sources.
25 lines
672 B
Go
25 lines
672 B
Go
package validator
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/authelia/authelia/v4/internal/configuration/schema"
|
|
"github.com/authelia/authelia/v4/internal/utils"
|
|
)
|
|
|
|
// ValidateLog validates the logging configuration.
|
|
func ValidateLog(config *schema.Configuration, validator *schema.StructValidator) {
|
|
if config.Log.Level == "" {
|
|
config.Log.Level = schema.DefaultLoggingConfiguration.Level
|
|
}
|
|
|
|
if config.Log.Format == "" {
|
|
config.Log.Format = schema.DefaultLoggingConfiguration.Format
|
|
}
|
|
|
|
if !utils.IsStringInSlice(config.Log.Level, validLoLevels) {
|
|
validator.Push(fmt.Errorf(errFmtLoggingLevelInvalid, strings.Join(validLoLevels, "', '"), config.Log.Level))
|
|
}
|
|
}
|