Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v1.12.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeBasePath added in v1.11.0

func NormalizeBasePath(p string) string

NormalizeBasePath canonicalizes an operator-supplied basePath: empty stays empty; non-empty values are forced to begin with `/` and not end with one. Used by both server bootstrap and tests so the normalization is a single shared definition.

Types

type AdminConfig

type AdminConfig struct {
	// HashedPassword is a PBKDF2-HMAC-SHA256 or bcrypt hash of the password for
	// the admin account.
	HashedPassword string `envconfig:"ADMIN_ACCOUNT_PASSWORD_HASH" required:"true"`
	// TokenIssuer is the value to be used in the ISS claim of ID tokens issued for
	// the admin account.
	TokenIssuer string `envconfig:"ADMIN_ACCOUNT_TOKEN_ISSUER" required:"true"`
	// TokenAudience is the value to be used in the AUD claim of ID tokens issued
	// for the admin account.
	TokenAudience string `envconfig:"ADMIN_ACCOUNT_TOKEN_AUDIENCE" required:"true"`
	// TokenSigningKey is the key used to sign ID tokens for the admin account.
	TokenSigningKey []byte `envconfig:"ADMIN_ACCOUNT_TOKEN_SIGNING_KEY" required:"true"`
	// TokenTTL specifies how long ID tokens for the admin account are valid. i.e.
	// The expiry will be the time of issue plus this duration.
	TokenTTL time.Duration `envconfig:"ADMIN_ACCOUNT_TOKEN_TTL" default:"24h"`
}

AdminConfig represents configuration for an admin account.

func AdminConfigFromEnv

func AdminConfigFromEnv() AdminConfig

AdminConfigFromEnv returns an AdminConfig populated from environment variables.

type ArgoCDConfig

type ArgoCDConfig struct {
	// URLs is a mapping from shard name to Argo CD URL
	URLs ArgoCDURLMap `envconfig:"ARGOCD_URLS"`
}

type ArgoCDURLMap

type ArgoCDURLMap map[string]string

func (*ArgoCDURLMap) Decode

func (a *ArgoCDURLMap) Decode(value string) error

type ServerConfig

type ServerConfig struct {
	StandardConfig
	// BasePath is the URL path prefix the server is reachable at, normalized
	// to begin with `/` and not end with one (e.g. `/kargo`). When non-empty,
	// every HTTP route the server registers — REST API, dex proxy, dashboard
	// SPA — lives under this prefix; the ingress controller
	// in front of the server MUST preserve the prefix (i.e. must NOT strip
	// it). Empty value means the server serves at the root.
	BasePath                    string
	SecretManagementEnabled     bool
	LocalMode                   bool // LocalMode is true if the server is running as a non-containerized process
	TLSConfig                   *TLSConfig
	OIDCConfig                  *oidc.Config
	AdminConfig                 *AdminConfig
	DexProxyConfig              *dex.ProxyConfig
	ArgoCDConfig                ArgoCDConfig
	PermissiveCORSPolicyEnabled bool
	RolloutsIntegrationEnabled  bool
	AnalysisRunLogURLTemplate   string
	AnalysisRunLogToken         string
	// AnalysisRunLogForwardUserToken indicates whether a user's own bearer token
	// should be available as a value in an authentication header for requests to
	// the AnalysisRun log service in cases where AnalysisRunLogToken is not set.
	// This option MUST only be set to true in environments where there is
	// absolute trust in the service from which AnalysisRun logs are retrieved.
	// Setting this to true is so discouraged that Kargo's Helm chart deliberately
	// doesn't directly expose this as an option. In practical terms, the option
	// exists only for the sake of Kargo EE, whose AnalysisRun log service is for
	// all intents and purposes an extension of the Kargo API itself.
	AnalysisRunLogForwardUserToken bool
	AnalysisRunLogHTTPHeaders      map[string]string
	SharedResourcesNamespace       string
	SystemResourcesNamespace       string
	KargoNamespace                 string
	// DefaultControllerName is the name of the controller that Stages with no
	// explicit spec.shard are reconciled by. The API server needs to know this
	// only to include it in a get controller heartbeats response so callers will
	// know which controller's liveness to associate with such Stages. The default
	// controller is often unnamed, so an empty string is a valid value.
	DefaultControllerName string
	// TrustedProxies are the IP addresses and CIDRs of proxies in front of the
	// server whose forwarding headers are believed when determining the IP
	// address a request came from. When empty, no forwarding header is
	// believed.
	TrustedProxies []string
	// ClientIPHeader names a header that every trusted proxy sets to the
	// client's IP address (e.g. CF-Connecting-IP). It is believed only on
	// requests arriving from a trusted proxy and takes precedence over
	// X-Forwarded-For.
	ClientIPHeader string
	// RequestLogAllEnabled indicates whether routine requests should be logged
	// at info level instead of debug level.
	RequestLogAllEnabled bool
	// RequestLogSourceIPEnabled indicates whether the IP address each request
	// came from should be logged.
	RequestLogSourceIPEnabled bool

	// AdditionalHandlers is a map of path patterns to HTTP handlers that will
	// be registered on the server's HTTP mux alongside its own handlers. This
	// permits downstream consumers to extend the server with additional
	// endpoints.
	AdditionalHandlers map[string]http.Handler

	// DashboardFS, when set, overrides the embedded UI filesystem used by the
	// dashboard handler. The filesystem should contain the built UI assets at
	// its root (i.e., index.html should be at the top level).
	DashboardFS fs.FS
}

func ServerConfigFromEnv

func ServerConfigFromEnv() ServerConfig

type StandardConfig

type StandardConfig struct {
	GracefulShutdownTimeout time.Duration `envconfig:"GRACEFUL_SHUTDOWN_TIMEOUT" default:"30s"`
}

type TLSConfig

type TLSConfig struct {
	CertPath string `envconfig:"TLS_CERT_PATH" required:"true"`
	KeyPath  string `envconfig:"TLS_KEY_PATH" required:"true"`
}

func TLSConfigFromEnv

func TLSConfigFromEnv() TLSConfig

Jump to

Keyboard shortcuts

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