https://github.com/oxplot/starenv
starenv allows populating environmental variables from variety of sources, such as AWS Parameter Store, GPG encrypted files and more, with extreme ease.
https://github.com/oxplot/starenv
Last synced: 7 months ago
JSON representation
starenv allows populating environmental variables from variety of sources, such as AWS Parameter Store, GPG encrypted files and more, with extreme ease.
- Host: GitHub
- URL: https://github.com/oxplot/starenv
- Owner: oxplot
- License: bsd-3-clause
- Created: 2021-09-06T07:55:49.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-01T03:03:13.000Z (over 2 years ago)
- Last Synced: 2025-04-10T00:05:04.764Z (7 months ago)
- Language: Go
- Homepage: https://pkg.go.dev/github.com/oxplot/starenv
- Size: 30.3 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Starenv
[](https://pkg.go.dev/github.com/oxplot/starenv)
**starenv** (`*env`) allows populating environmental variables from
variety of sources, such as AWS Parameter Store, GPG encrypted files
and more, with extreme ease.
For the impatient, import the `autoload` package and you're set:
```go
package main
import (
"fmt"
"os"
_ "github.com/oxplot/starenv/autoload"
)
func main() {
fmt.Printf("GITHUB_TOKEN=%s\n", os.Getenv("GITHUB_TOKEN"))
}
```
and set the value of the environmental variable to load from Parameter
Store:
```sh
$ export GITHUB_TOKEN=*ssm:/github_token
$ go run main.go
GITHUB_TOKEN=abcdef-1235143-abcdef-123-abcdef-12314
```
or from a GPG encrypted file:
```sh
$ export GITHUB_TOKEN=*gpg*file:github_token.gpg
$ go run main.go
GITHUB_TOKEN=abcdef-1235143-abcdef-123-abcdef-12314
```
why not ditch the file and embed its content:
```sh
$ export GITHUB_TOKEN=*gpg*b64:eNeO7D2rBrBOOcW6TuETyHdyPEOaAfdgaTzgOTSvROI=
$ go run main.go
GITHUB_TOKEN=abcdef-1235143-abcdef-123-abcdef-12314
```
and thanks to the amazing [godotenv](https://github.com/joho/godotenv)
which is run as part of starenv's `autoload` package, you can even do:
```sh
$ echo 'GITHUB_TOKEN=*keyring:awesome_app/github_token' > .env
$ go run main.go
GITHUB_TOKEN=abcdef-1235143-abcdef-123-abcdef-12314
```
For a full list, see [the
docs](https://pkg.go.dev/github.com/oxplot/starenv/derefer#NewDefault).