Documentation
¶
Overview ¶
Package config provides centralized configuration management for Nivo services.
Index ¶
Constants ¶
const ( // MaxSearchQueryLength is the maximum length for search query parameters. MaxSearchQueryLength = 200 // DefaultPageLimit is the default number of items returned in paginated responses. DefaultPageLimit = 50 // MaxPageLimit is the maximum number of items that can be requested in a single page. MaxPageLimit = 100 // MaxStatementDays is the maximum date range for statement exports. MaxStatementDays = 365 // MaxStatementDuration is MaxStatementDays as a time.Duration. MaxStatementDuration = MaxStatementDays * 24 * time.Hour // MaxResponseBodySize is the maximum size for HTTP response bodies (1MB). // Used by service clients to prevent OOM from malicious/broken responses. MaxResponseBodySize = 1 << 20 // 1MB )
API Limits - used across handlers for consistent validation
Variables ¶
This section is empty.
Functions ¶
func GetEnvAsBool ¶
GetEnvAsBool returns the value of an environment variable as a boolean or a default value.
func GetEnvAsDuration ¶
GetEnvAsDuration returns the value of an environment variable as a duration or a default value.
func GetEnvAsInt ¶
GetEnvAsInt returns the value of an environment variable as an integer or a default value.
func GetEnvOrDefault ¶
GetEnvOrDefault returns the value of an environment variable or a default value.
Types ¶
type Config ¶
type Config struct {
// Application
Environment string
ServiceName string
ServicePort int
LogLevel string
// Localization (India-centric defaults)
Timezone string // Default: Asia/Kolkata (IST - UTC+5:30)
DefaultCurrency string // Default: INR (Indian Rupee)
CountryCode string // Default: IN (India)
// Database
DatabaseURL string
DatabaseHost string
DatabasePort int
DatabaseUser string
DatabasePassword string
DatabaseName string
DatabaseSSLMode string
// Redis
RedisURL string
RedisHost string
RedisPort int
RedisPassword string
RedisDB int
// NSQ
NSQLookupDAddr string
NSQDAddr string
// JWT
JWTSecret string
JWTExpiry time.Duration
JWTRefreshExp time.Duration
// Server
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
// Observability
PrometheusPort int
EnableProfiling bool
}
Config holds application configuration loaded from environment variables.
func (*Config) IsDevelopment ¶
IsDevelopment returns true if running in development environment.
func (*Config) IsProduction ¶
IsProduction returns true if running in production environment.