config

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinJWTSecretLength is the minimum required length for JWT secrets
	// HS256 requires at least 32 bytes (256 bits) for security, but we use 16 as a practical minimum
	MinJWTSecretLength = 16
)

Variables

This section is empty.

Functions

func ValidateSecrets added in v0.1.7

func ValidateSecrets(s *Secrets) error

ValidateSecrets validates that secrets meet security requirements.

Types

type AppConfig added in v0.1.7

type AppConfig struct {
	Config
	Secrets
}

AppConfig combines non-sensitive configuration with sensitive secrets. This is the main configuration struct used by the application.

func NewAppConfig added in v0.1.7

func NewAppConfig(cfg *Config, secrets *Secrets) (*AppConfig, error)

NewAppConfig creates a complete application configuration by combining non-sensitive config with the provided secrets.

type Config

type Config struct {
	DBDialect            string `env:"DB_DIALECT,required"`
	ServerPort           string `env:"SERVER_PORT"`
	EntSchemaPath        string `env:"ENT_SCHEMA_PATH"`
	CentrifugoApiAddress string `env:"CENTRIFUGO_API_ADDRESS,required"`
	FileStorageProvider  string `env:"FILE_STORAGE_PROVIDER"`
	FileStoragePath      string `env:"FILE_STORAGE_PATH"`
	// Environment specifies which Infisical environment to fetch secrets from (dev, staging, prod)
	Environment string `env:"APP_ENVIRONMENT"`
}

Config holds non-sensitive application configuration loaded from environment variables. Sensitive credentials (DSN, SecretKey, CentrifugoKey) are managed separately via the secrets package.

func New

func New() (*Config, error)

New loads non-sensitive configuration from environment variables. Use NewWithSecrets to get a complete AppConfig with secrets loaded.

type Secrets added in v0.1.7

type Secrets struct {
	DSN           string
	SecretKey     string
	CentrifugoKey string
}

Secrets holds sensitive credentials fetched from Infisical or environment variables. These values should never be logged or written to disk.

Jump to

Keyboard shortcuts

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