https://github.com/akupila/ssm
Go package for reading config values from AWS SSM Parameter store
https://github.com/akupila/ssm
aws config go golang ssm
Last synced: 3 months ago
JSON representation
Go package for reading config values from AWS SSM Parameter store
- Host: GitHub
- URL: https://github.com/akupila/ssm
- Owner: akupila
- License: mit
- Created: 2019-08-29T07:22:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-29T20:08:38.000Z (almost 7 years ago)
- Last Synced: 2025-01-17T03:33:38.106Z (over 1 year ago)
- Topics: aws, config, go, golang, ssm
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ssm [](https://godoc.org/github.com/akupila/ssm)
[](https://github.com/akupila/ssm/actions)
[](https://goreportcard.com/report/github.com/akupila/ssm)
[](https://codecov.io/gh/akupila/ssm)
[](./LICENSE)
Read config values from [AWS System Manager Parameter Store][1] by names
defined using struct tags.
## Example
Parameters stored in SSM:
```
/dev
/database
/username
/password
/host
/port
/name
/auth0
/domain
/client_id
/client_secret
/another
/...
/prod
...
```
Read the required `dev` values:
```go
params := ssm.NewParamStore(
ssm.WithPrefix("dev"),
ssm.WithParseNumber(),
)
type Config struct {
DB struct {
User string `ssm:"username"`
Pass string `ssm:"password"`
Host string `ssm:"host"`
Port int `ssm:"port"`
Name string `ssm:"name"`
} `ssm:"database"`
Auth0 struct {
ClientID string `ssm:"client_id"`
ClientSecret string `ssm:"client_secret"`
} `ssm:"auth0"`
// Fields not included are not read from SSM
}
var cfg Config
if err := params.Read(context.Background(), &cfg); err != nil {
// Handle error
}
// cfg is now ready to use
```
See [GoDoc][2] for more details.
[1]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html
[2]: http://godoc.org/github.com/akupila/ssm