Documentation
¶
Overview ¶
Package config provides small dependency-free production configuration helpers for fh applications. It intentionally avoids replacing user config systems; it gives deployments a safe baseline with env overrides and duration parsing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequireSecretString ¶
RequireSecretString resolves a secret and fails when neither source is configured. It is useful for production-only credentials and private keys.
func SecretString ¶
SecretString resolves one secret at startup. A mounted secret file is preferred because environment values may be exposed through process inspection, crash reports, and child-process inheritance. Direct environment values remain supported for compatibility, but configuring both sources is rejected so key rotation and deployment mistakes fail closed.
SecretString does not cache values or watch files. Call it during startup and retain the decoded key/credential in the component that consumes it.
Types ¶
type Config ¶
type Config struct {
Server Server `json:"server"`
StartupBanner StartupBanner `json:"startup_banner"`
Reliability Reliability `json:"reliability"`
}
func ApplyEnv ¶
ApplyEnv overlays values from environment variables using the supplied prefix. Example with prefix FH: FH_ADDR, FH_READ_TIMEOUT, FH_RELIABILITY_ENABLED.
func LoadJSONFile ¶
type Reliability ¶
type Server ¶
type Server struct {
Addr string `json:"addr"`
SecureByDefault bool `json:"secure_by_default"`
ReadTimeout string `json:"read_timeout"`
ReadHeaderTimeout string `json:"read_header_timeout"`
RequestBodyTimeout string `json:"request_body_timeout"`
WriteTimeout string `json:"write_timeout"`
HandlerTimeout string `json:"handler_timeout"`
IdleTimeout string `json:"idle_timeout"`
TLSHandshakeTimeout string `json:"tls_handshake_timeout"`
HTTP2IdleTimeout string `json:"http2_idle_timeout"`
MaxConnections int `json:"max_connections"`
MaxConnectionsPerIP int `json:"max_connections_per_ip"`
MaxRequestBodySize int `json:"max_request_body_size"`
MaxHeaderListSize int `json:"max_header_list_size"`
MaxHeaderCount int `json:"max_header_count"`
MaxRequestLineSize int `json:"max_request_line_size"`
DisableHTTP2 bool `json:"disable_http2"`
DisableH2C bool `json:"disable_h2c"`
Debug bool `json:"debug"`
Environment string `json:"environment"`
}