Documentation ¶
Overview ¶
Package xconfig can load config from shell env variables, aws ssm and docker/k8s secrets.
Index ¶
- Constants
- func Load(dst interface{}) error
- func LoadEnv(dst interface{}) error
- func LoadEnvAndAwsSsm(dst interface{}, path string) error
- func LoadEnvAndDockerSecret(dst interface{}) error
- func LoadEnvAndSecret(dst interface{}, secretPath string) error
- func MustLoad(dst interface{})
- func SetAwsConfig(config *aws.Config)
- type AwsSsmParamStore
- type Basic
Constants ¶
const ( EnvLocal = "local" EnvProduction = "production" // this env only use in metric-related projects EnvTestnetDev = "testnet-dev" EnvTestnetProd = "testnet-prod" )
const AwsSsmParamStorePath = "AWS_SSM_PARAM_STORE_PATH"
AwsSsmParamStorePath the environment variable name for AWS SSM Param Store
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load(dst interface{}) error
Load config to `dst` struct pointer from shell env variables and docker secrets.
func LoadEnv ¶
func LoadEnv(dst interface{}) error
LoadEnv load config to `dst` struct pointer from shell env variables only
func LoadEnvAndAwsSsm ¶
LoadEnvAndAwsSsm load config to `dst` struct pointer from shell env variables and aws ssm param store.
func LoadEnvAndDockerSecret ¶
func LoadEnvAndDockerSecret(dst interface{}) error
LoadEnvAndDockerSecret load config to `dst` struct pointer from shell env variables and docker secrets.
func LoadEnvAndSecret ¶
LoadEnvAndSecret load config to `dst` struct pointer from shell env variables and container secrets.
func MustLoad ¶
func MustLoad(dst interface{})
MustLoad just same as Load(), but it panics when an error occurs.
func SetAwsConfig ¶
SetAwsConfig if you want load config from aws ssm parameter store, you can set aws config manually. If it is not set, it will try to use default aws config, only when AWS_SSM_PARAM_STORE_PATH is set .
Types ¶
type AwsSsmParamStore ¶
type AwsSsmParamStore struct {
Path string
}
AwsSsmParamStore is used in config struct, it will load AWS_SSM_PARAM_STORE_PATH from ENV
type Basic ¶
type Basic struct { Env string `default:"local"` Debug bool `default:"false"` Release string `default:"local-debug"` // github build number, injected in image by github action // slack config is optional, if exists, it will send all warn/error log to slack SlackToken string SlackChannel string `default:"C076H0HBZLZ"` // default is channel testnet-dev }
Basic is the shared basic configuration for all projects