2021-03-22 09:04:09 +00:00
|
|
|
package configuration
|
|
|
|
|
2021-08-03 09:55:21 +00:00
|
|
|
import (
|
|
|
|
"errors"
|
2023-05-08 03:30:49 +00:00
|
|
|
"math"
|
|
|
|
"time"
|
2021-08-03 09:55:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// DefaultEnvPrefix is the default environment prefix.
|
|
|
|
const DefaultEnvPrefix = "AUTHELIA_"
|
|
|
|
|
|
|
|
// DefaultEnvDelimiter is the default environment delimiter.
|
|
|
|
const DefaultEnvDelimiter = "_"
|
|
|
|
|
|
|
|
const (
|
|
|
|
constSecretSuffix = "_FILE"
|
|
|
|
|
|
|
|
constDelimiter = "."
|
|
|
|
|
|
|
|
constWindows = "windows"
|
|
|
|
)
|
|
|
|
|
2022-04-03 12:44:52 +00:00
|
|
|
var (
|
|
|
|
errNoValidator = errors.New("no validator provided")
|
|
|
|
errNoSources = errors.New("no sources provided")
|
|
|
|
|
|
|
|
errDecodeNonPtrMustHaveValue = errors.New("must have a non-empty value")
|
|
|
|
)
|
|
|
|
|
2021-08-03 09:55:21 +00:00
|
|
|
const (
|
|
|
|
errFmtSecretAlreadyDefined = "secrets: error loading secret into key '%s': it's already defined in other " +
|
|
|
|
"configuration sources"
|
2023-04-08 06:02:34 +00:00
|
|
|
errFmtSecretOSError = "secrets: error loading secret path %s into key '%s': %w"
|
|
|
|
errFmtSecretOSPermission = "secrets: error loading secret path %s into key '%s': file permission error occurred: %w"
|
|
|
|
errFmtSecretOSNotExist = "secrets: error loading secret path %s into key '%s': file does not exist error occurred: %w"
|
2021-08-03 09:55:21 +00:00
|
|
|
errFmtGenerateConfiguration = "error occurred generating configuration: %+v"
|
2022-04-03 12:44:52 +00:00
|
|
|
|
2022-10-02 02:07:40 +00:00
|
|
|
errFmtDecodeHookCouldNotParse = "could not decode '%s' to a %s%s: %w"
|
|
|
|
errFmtDecodeHookCouldNotParseBasic = "could not decode to a %s%s: %w"
|
|
|
|
errFmtDecodeHookCouldNotParseEmptyValue = "could not decode an empty value to a %s%s: %w"
|
2021-08-03 09:55:21 +00:00
|
|
|
)
|
|
|
|
|
2023-05-08 03:30:49 +00:00
|
|
|
const (
|
|
|
|
durationMax = time.Duration(math.MaxInt64)
|
|
|
|
)
|
|
|
|
|
2022-12-23 10:58:54 +00:00
|
|
|
// IMPORTANT: There is an uppercase copy of this in github.com/authelia/authelia/internal/templates named
|
|
|
|
// envSecretSuffixes.
|
|
|
|
// Make sure you update these at the same time.
|
2022-10-31 00:52:14 +00:00
|
|
|
var secretSuffixes = []string{"key", "secret", "password", "token", "certificate_chain"}
|