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.
21 lines
528 B
Go
21 lines
528 B
Go
package validator
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/authelia/authelia/v4/internal/configuration/schema"
|
|
"github.com/authelia/authelia/v4/internal/utils"
|
|
)
|
|
|
|
// ValidateTheme validates and update Theme configuration.
|
|
func ValidateTheme(config *schema.Configuration, validator *schema.StructValidator) {
|
|
if config.Theme == "" {
|
|
config.Theme = "light"
|
|
}
|
|
|
|
if !utils.IsStringInSlice(config.Theme, validThemeNames) {
|
|
validator.Push(fmt.Errorf(errFmtThemeName, strings.Join(validThemeNames, "', '"), config.Theme))
|
|
}
|
|
}
|