No longer maintained, in favor of: https://github.com/hookactions/config
Pre-process config values by reading secrets from AWS.
// main.go
package main
import (
"context"
"fmt"
figAws "github.com/hookactions/fig/aws"
"github.com/spf13/viper"
)
func main() {
viper.SetConfigName("config")
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
panic(err)
}
fig, err := figAws.New(nil)
if err != nil {
panic(err)
}
fig.PreProcessConfigItems(context.Background())
value := viper.GetString("my_var")
fmt.Println(value)
}
echo "my_var: sm://foo" >> config.yaml
go run main.go
sm://
– Get string value from secrets managersmb://
– Get binary value from secrets managerssm://
– Get string value from parameter store- Note: decryption of the value is automatically requested.
ssmb64://
– Get base64 encoded binary value from parameter store- Note: decryption of the value is automatically requested.
Pre-process config values by reading secrets from AWS.
// main.go
package main
import (
"context"
"fmt"
"os"
"github.com/hookactions/fig/awsEnv"
)
func main() {
fig, err := awsEnv.New()
if err != nil {
panic(err)
}
fmt.Println(fig.GetEnv(context.Background(), "MY_VAR"))
}
MY_VAR=sm://foo go run main.go
sm://
– Get string value from secrets managerssm://
– Get string value from parameter store- Note: decryption of the value is automatically requested.