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 int `koanf:"access_token_expiry"`
RefreshTokenExpiry int `koanf:"refresh_token_expiry"`
SessionLifetime int `koanf:"session_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"`
}
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"`
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 PublicConfig ¶
type PublicConfig struct {
BaseURL string `koanf:"base_url"`
S3AssetsURL string `koanf:"s3_assets_url"`
VersionCheckURL string `koanf:"version_check_url"`
TrustedOrigins []string `koanf:"trusted_origins"`
JwtAccessTokenExpiry int `koanf:"jwt_access_token_expiry"`
JwtRefreshTokenExpiry int `koanf:"jwt_refresh_token_expiry"`
}
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"`
}
Click to show internal directories.
Click to hide internal directories.