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

config

package
v1.11.9 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: 11 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 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, ConnectRPC, 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
	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
	RestConfig            *rest.Config

	// 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