config

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyBbUser                        = "BB_USER"
	KeyGitCommitterName              = "GIT_COMMITTER_NAME"
	KeyGitCommitterEmail             = "GIT_COMMITTER_EMAIL"
	KeyKafkaUser                     = "KAFKA_USER"
	KeyKafkaTopic                    = "KAFKA_TOPIC"
	KeyKafkaSeedBrokers              = "KAFKA_SEED_BROKERS"
	KeyKafkaGroupIdOverride          = "KAFKA_GROUP_ID_OVERRIDE"
	KeyKeySetUrl                     = "KEY_SET_URL"
	KeyMetadataRepoUrl               = "METADATA_REPO_URL"
	KeyOwnerRegex                    = "OWNER_REGEX"
	KeyUpdateJobIntervalMinutes      = "UPDATE_JOB_INTERVAL_MINUTES"
	KeyUpdateJobTimeoutSeconds       = "UPDATE_JOB_TIMEOUT_SECONDS"
	KeyVaultSecretsBasePath          = "VAULT_SECRETS_BASE_PATH"
	KeyVaultKafkaSecretPath          = "VAULT_KAFKA_SECRET_PATH"
	KeyAlertTargetPrefix             = "ALERT_TARGET_PREFIX"
	KeyAlertTargetSuffix             = "ALERT_TARGET_SUFFIX"
	KeyAdditionalPromoters           = "ADDITIONAL_PROMOTERS"
	KeyAdditionalPromotersFromOwners = "ADDITIONAL_PROMOTERS_FROM_OWNERS"
	KeyElasticApmDisabled            = "ELASTIC_APM_DISABLED"
)

Variables

View Source
var CustomConfigItems = []auconfigapi.ConfigItem{
	{
		Key:         KeyBbUser,
		EnvName:     KeyBbUser,
		Default:     "",
		Description: "bitbucket username for api and git clone service-metadata access",
		Validate:    auconfigenv.ObtainNotEmptyValidator(),
	},
	{
		Key:         KeyGitCommitterName,
		EnvName:     KeyGitCommitterName,
		Default:     "",
		Description: "name to use for git commits",
		Validate:    auconfigenv.ObtainNotEmptyValidator(),
	},
	{
		Key:         KeyGitCommitterEmail,
		EnvName:     KeyGitCommitterEmail,
		Default:     "",
		Description: "email address to use for git commits",
		Validate:    auconfigenv.ObtainNotEmptyValidator(),
	},
	{
		Key:         KeyKafkaUser,
		EnvName:     KeyKafkaUser,
		Default:     "",
		Description: "optional: kafka user (needed to send kafka notifications), leaving this or any of the other *KAFKA* fields empty will switch off all Kafka functionality",
		Validate:    auconfigenv.ObtainPatternValidator("^(|[a-z0-9-]+)$"),
	},
	{
		Key:         KeyKafkaTopic,
		EnvName:     KeyKafkaTopic,
		Default:     "",
		Description: "optional: kafka user (needed to send kafka notifications), leaving this or any of the other *KAFKA* fields empty will switch off all Kafka functionality",
		Validate:    auconfigenv.ObtainPatternValidator("^(|[a-z0-9-]+)$"),
	},
	{
		Key:         KeyKafkaSeedBrokers,
		EnvName:     KeyKafkaSeedBrokers,
		Default:     "",
		Description: "optional: comma separated list of kafka seed broker URLs (needed to send kafka notifications), leaving this or any of the other *KAFKA* fields empty will switch off all Kafka functionality",
		Validate:    auconfigenv.ObtainPatternValidator("^(|([a-z0-9-]+.[a-z0-9-]+.[a-z]{2,3}:9092)(,[a-z0-9-]+.[a-z0-9-]+.[a-z]{2,3}:9092)*)$"),
	},
	{
		Key:         KeyKafkaGroupIdOverride,
		EnvName:     KeyKafkaGroupIdOverride,
		Default:     "",
		Description: "optional: a kafka group id to use for subscribing to update events. Mainly useful on localhost. If empty, group id is derived from 3rd oktet of non-trivial local ip (as proxy for the k8s worker node)",
		Validate:    auconfigenv.ObtainPatternValidator("^(|[a-z0-9-]+)$"),
	},
	{
		Key:         KeyKeySetUrl,
		EnvName:     KeyKeySetUrl,
		Default:     "",
		Description: "keyset URL of your OIDC identity provider",
		Validate:    auconfigenv.ObtainPatternValidator("^https?:.*$"),
	},
	{
		Key:         KeyMetadataRepoUrl,
		EnvName:     KeyMetadataRepoUrl,
		Default:     "",
		Description: "git clone url for service-metadata repository",
		Validate:    auconfigenv.ObtainNotEmptyValidator(),
	},
	{
		Key:         KeyOwnerRegex,
		EnvName:     KeyOwnerRegex,
		Default:     ".*",
		Description: "regular expression to filter owners. Useful on localhost or for test instances to speed up service startup.",
		Validate:    auconfigapi.ConfigNeedsNoValidation,
	},
	{
		Key:         KeyUpdateJobIntervalMinutes,
		EnvName:     KeyUpdateJobIntervalMinutes,
		Default:     "5",
		Description: "time in minutes between cache update. Must be a divisor of 60 (used in cron expression) - pick one of the choices",
		Validate:    auconfigenv.ObtainPatternValidator("^(1|2|3|4|5|6|10|12|15|20|30)$"),
	},
	{
		Key:         KeyUpdateJobTimeoutSeconds,
		EnvName:     KeyUpdateJobTimeoutSeconds,
		Default:     "30",
		Description: "timeout for the cache update job in seconds. Must be less than 60 * UPDATE_JOB_INTERVAL_MINUTES",
		Validate:    auconfigenv.ObtainUintRangeValidator(10, 60),
	},
	{
		Key:         KeyVaultSecretsBasePath,
		EnvName:     KeyVaultSecretsBasePath,
		Default:     "",
		Description: "total vaul secret path is composed of VAULT_SECRETS_BASE_PATH/ENVIRONMENT/VAULT_SECRET_PATH",
		Validate:    auconfigenv.ObtainPatternValidator("^(|[a-z0-9-/]+)$"),
	},
	{
		Key:         KeyVaultKafkaSecretPath,
		EnvName:     KeyVaultKafkaSecretPath,
		Default:     "",
		Description: "optional: kafka secret path in vault (needed to send kafka notifications), leaving this or any of the other *KAFKA* fields empty will switch off all Kafka functionality, including the Vault query for Kafka credentials",
		Validate:    auconfigenv.ObtainPatternValidator("^(|[a-z0-9-/]+)$"),
	},
	{
		Key:      KeyAlertTargetPrefix,
		EnvName:  KeyAlertTargetPrefix,
		Default:  "",
		Validate: auconfigenv.ObtainPatternValidator("^((http|https)://|)[a-z0-9-.]+.[a-z]{2,3}/$"),
	},
	{
		Key:      KeyAlertTargetSuffix,
		EnvName:  KeyAlertTargetSuffix,
		Default:  "",
		Validate: auconfigenv.ObtainPatternValidator("^@[a-z0-9-]+.[a-z]{2,3}$"),
	},
	{
		Key:         KeyAdditionalPromoters,
		EnvName:     KeyAdditionalPromoters,
		Default:     "",
		Description: "promoters to be added for all services. Can be left empty, or contain a comma separated list of usernames",
		Validate:    auconfigenv.ObtainPatternValidator("^|[a-z](-?[a-z0-9]+)*(,[a-z](-?[a-z0-9]+)*)*$"),
	},
	{
		Key:         KeyAdditionalPromotersFromOwners,
		EnvName:     KeyAdditionalPromotersFromOwners,
		Default:     "",
		Description: "owner aliases from which to get additional promoters to be added for all services. Can be left empty, or contain a comma separated list of owner aliases",
		Validate:    auconfigenv.ObtainPatternValidator("^|[a-z](-?[a-z0-9]+)*(,[a-z](-?[a-z0-9]+)*)*$"),
	},
	{
		Key:         KeyElasticApmDisabled,
		EnvName:     KeyElasticApmDisabled,
		Default:     "false",
		Description: "Disable Elastic APM middleware. Supports all values supported by ParseBool (https://pkg.go.dev/strconv#ParseBool).",
		Validate: func(key string) error {
			value := auconfigenv.Get(key)
			_, err := strconv.ParseBool(value)
			return err
		},
	},
}

Functions

func New

func New() auacornapi.Acorn

Types

type CustomConfigImpl

type CustomConfigImpl struct {
	VBbUser                        string
	VGitCommitterName              string
	VGitCommitterEmail             string
	VKafkaUser                     string
	VKafkaTopic                    string
	VKafkaSeedBrokers              string
	VKeySetUrl                     string
	VKafkaGroupIdOverride          string
	VMetadataRepoUrl               string
	VOwnerRegex                    string
	VUpdateJobIntervalCronPart     string
	VUpdateJobTimeoutSeconds       uint16
	VVaultSecretsBasePath          string
	VVaultKafkaSecretPath          string
	VAlertTargetPrefix             string
	VAlertTargetSuffix             string
	VAdditionalPromoters           string
	VAdditionalPromotersFromOwners string
	VElasticApmDisabled            bool
}

func (*CustomConfigImpl) AdditionalPromoters added in v0.6.0

func (c *CustomConfigImpl) AdditionalPromoters() []string

func (*CustomConfigImpl) AdditionalPromotersFromOwners added in v0.3.0

func (c *CustomConfigImpl) AdditionalPromotersFromOwners() []string

func (*CustomConfigImpl) AlertTargetPrefix

func (c *CustomConfigImpl) AlertTargetPrefix() string

func (*CustomConfigImpl) AlertTargetSuffix

func (c *CustomConfigImpl) AlertTargetSuffix() string

func (*CustomConfigImpl) BbUser

func (c *CustomConfigImpl) BbUser() string

func (*CustomConfigImpl) ElasticApmEnabled added in v0.5.0

func (c *CustomConfigImpl) ElasticApmEnabled() bool

func (*CustomConfigImpl) GitCommitterEmail

func (c *CustomConfigImpl) GitCommitterEmail() string

func (*CustomConfigImpl) GitCommitterName

func (c *CustomConfigImpl) GitCommitterName() string

func (*CustomConfigImpl) KafkaGroupIdOverride

func (c *CustomConfigImpl) KafkaGroupIdOverride() string

func (*CustomConfigImpl) KafkaSeedBrokers

func (c *CustomConfigImpl) KafkaSeedBrokers() string

func (*CustomConfigImpl) KafkaTopic

func (c *CustomConfigImpl) KafkaTopic() string

func (*CustomConfigImpl) KafkaUser

func (c *CustomConfigImpl) KafkaUser() string

func (*CustomConfigImpl) KeySetUrl

func (c *CustomConfigImpl) KeySetUrl() string

func (*CustomConfigImpl) MetadataRepoUrl

func (c *CustomConfigImpl) MetadataRepoUrl() string

func (*CustomConfigImpl) Obtain

func (c *CustomConfigImpl) Obtain(getter func(key string) string)

func (*CustomConfigImpl) OwnerRegex

func (c *CustomConfigImpl) OwnerRegex() string

func (*CustomConfigImpl) UpdateJobIntervalCronPart

func (c *CustomConfigImpl) UpdateJobIntervalCronPart() string

func (*CustomConfigImpl) UpdateJobTimeoutSeconds

func (c *CustomConfigImpl) UpdateJobTimeoutSeconds() uint16

func (*CustomConfigImpl) VaultKafkaSecretPath

func (c *CustomConfigImpl) VaultKafkaSecretPath() string

func (*CustomConfigImpl) VaultSecretsBasePath

func (c *CustomConfigImpl) VaultSecretsBasePath() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL