Documentation
¶
Overview ¶
Package config loads runtime settings in layers; later layers win:
defaults → --env-file → system env → overrides
Empty values do not shadow defaults. Unknown keys fail in the env file but are ignored in the system environment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
PrivateKey string `koanf:"private_key"`
PublicKey string `koanf:"public_key"`
SecretKey string `koanf:"secret_key"`
// AccessTokenExpiry bounds the internal bearer JWT the SPA sends
// on RPC calls; refresh stays cookie-only.
AccessTokenExpiry int `koanf:"access_token_expiry"`
// SessionLifetime bounds a session issued with "remember me".
SessionLifetime int `koanf:"session_lifetime"`
// SessionShortLifetime bounds a session issued without "remember
// me"; it must not exceed SessionLifetime.
SessionShortLifetime int `koanf:"session_short_lifetime"`
GithubClientID string `koanf:"github_client_id"`
GithubClientSecret string `koanf:"github_client_secret"`
GoogleClientID string `koanf:"google_client_id"`
GoogleClientSecret string `koanf:"google_client_secret"`
}
AuthConfig holds the internal authentication lifetimes. Every duration is in seconds, matching the rest of the environment surface.
type Config ¶
type Config struct {
Host string `koanf:"host"`
Port int `koanf:"port"`
App AppConfig `koanf:"app"`
Auth AuthConfig `koanf:"auth"`
Database DatabaseConfig `koanf:"database"`
Mailer MailerConfig `koanf:"mailer"`
OIDC OIDCConfig `koanf:"oidc"`
Public PublicConfig `koanf:"public"`
Queue QueueConfig `koanf:"queue"`
Storage StorageConfig `koanf:"storage"`
}
Config defines runtime settings and their koanf keys.
func Load ¶
func Load(opts LoadOptions) (*Config, error)
Load assembles layered config and decodes it into Config.
func (*Config) PrivateKeyPath ¶
PrivateKeyPath returns the private key path.
func (*Config) PublicKeyPath ¶
PublicKeyPath returns the public key path.
type DatabaseConfig ¶
type DatabaseConfig struct {
URL string `koanf:"url"`
}
type LoadOptions ¶
type LoadOptions struct {
// EnvFile is an optional dotenv file between defaults and env.
EnvFile string
// Overrides win over everything (resolved CLI flags).
Overrides map[string]any
}
LoadOptions configures Load.
type MailerConfig ¶
type OIDCConfig ¶ added in v0.0.12
type OIDCConfig struct {
// AccessTokenExpiry and RefreshTokenExpiry are the provider
// defaults for clients without their own durations.
AccessTokenExpiry int `koanf:"access_token_expiry"`
RefreshTokenExpiry int `koanf:"refresh_token_expiry"`
// AuthorizationCodeExpiry bounds the one-time code lifetime.
AuthorizationCodeExpiry int `koanf:"authorization_code_expiry"`
// InteractionExpiry bounds the sign-in/consent bridge.
InteractionExpiry int `koanf:"interaction_expiry"`
// DeviceCodeExpiry bounds the device authorization window
// (RFC 8628 6.1).
DeviceCodeExpiry int `koanf:"device_code_expiry"`
// PARExpiry bounds a pushed authorization request_uri lifetime
// (RFC 9126 3.2.2 recommends keeping it short).
PARExpiry int `koanf:"par_expiry"`
}
OIDCConfig holds the relying-party protocol lifetimes. A client's own access/refresh durations override the two token defaults.
type PublicConfig ¶
type QueueConfig ¶
type StorageConfig ¶
type StorageConfig struct {
DataDir string `koanf:"data_dir"`
MaxUploadSize int64 `koanf:"max_upload_size"`
S3AccessKeyID string `koanf:"s3_access_key_id"`
S3BucketDefault string `koanf:"s3_bucket_default"`
S3EndpointURL string `koanf:"s3_endpoint_url"`
S3ForcePathStyle bool `koanf:"s3_force_path_style"`
S3PathPrefix *string `koanf:"s3_path_prefix"`
S3Region string `koanf:"s3_region"`
S3SecretAccessKey string `koanf:"s3_secret_access_key"`
S3SignedURLExpires int `koanf:"s3_signed_url_expires"`
}