package
module
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Dec 14, 2021
License: MIT
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
ssmconfig
Gets Configuration values from AWS stored SSM and meant to integrate with other config frameworks which may not features which support ssm params.
Example
package main
import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/bellhops/auth-api/pkg/ssmconfig"
"github.com/kelseyhightower/envconfig"
)
type Config struct {
LogLevel string `envconfig:"LOG_LEVEL" default:"info"`
WebPort string `envconfig:"WEB_PORT" default:"8000"`
Environment string `envconfig:"ENVIRONMENT" default:"local"`
StoreLicenseKey string `envconfig:"STORE_LICENSE_KEY" default:"0000000000000000000000000000000000000000" ssmparam:"/store/licensekey"`
}
func main() {
var config Config
if err := envconfig.Process("", &config); err != nil {
panic(err)
}
if config.Environment != "local" {
sess, err := session.NewSession()
if err != nil {
panic(err)
}
ssmsvc := ssm.New(sess)
if err := ssmconfig.Process(ssmsvc, "/prefix", &cfg); err != nil {
panic(err)
}
}
}
Documentation
¶
Process processes the config struct and any fields with ssmparam tag will be filled.
errors if any fields cannot be
Source Files
¶
Click to show internal directories.
Click to hide internal directories.