Documentation ¶
Index ¶
Constants ¶
View Source
const EnvPrefix = "APP_SERVER_"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { K *koanf.Koanf `json:"-"` Stage string `json:"stage" yaml:"stage"` Logging LoggingConfig `json:"logging" yaml:"logging"` Server ServerConfig `json:"server" yaml:"server"` DB database.Config `json:"db" yaml:"db"` Cache cache.Config `json:"cache" yaml:"cache"` Metric MetricsConfig `json:"metric" yaml:"metric"` }
func Load ¶
Load loads config with below orders. 1. defaultConfig constants. 2. environment variables having "APP_SERVER_" prefix. 3. config file if provided 4. configMap if not empty.
func (*Config) MarshalJSON ¶
type LoggingConfig ¶
type MetricsConfig ¶
type ServerConfig ¶
type ServerConfig struct { Port int `json:"port" yaml:"port"` ReadTimeout time.Duration `json:"read-timeout" yaml:"read-timeout"` WriteTimeout time.Duration `json:"write-timeout" yaml:"write-timeout"` GracefulShutdown time.Duration `json:"graceful-shutdown" yaml:"graceful-shutdown"` Cors struct { AllowAll bool `json:"allow-all" yaml:"allow-all"` Origin []string `json:"origin" yaml:"origin"` BrowserExt bool `json:"browser-ext" yaml:"browser-ext"` } `json:"cors" yaml:"cors"` Docs struct { Enabled bool `json:"enabled" yaml:"enabled"` Path string `json:"path" yaml:"path"` } `json:"docs" yaml:"docs"` Auth struct { JWT struct { Realm string `json:"realm" yaml:"realm"` Key string `json:"key" yaml:"key"` Timeout time.Duration `json:"timeout" yaml:"timeout"` MaxRefresh time.Duration `json:"max-refresh" yaml:"max-refresh"` } `json:"jwt" yaml:"jwt"` } `json:"auth" yaml:"auth"` }
Click to show internal directories.
Click to hide internal directories.