Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imjasonh/appengine-value
Utility library to handle simple secret values in an App Engine app
https://github.com/imjasonh/appengine-value
Last synced: about 1 month ago
JSON representation
Utility library to handle simple secret values in an App Engine app
- Host: GitHub
- URL: https://github.com/imjasonh/appengine-value
- Owner: imjasonh
- License: apache-2.0
- Created: 2014-05-17T18:24:32.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-22T20:43:27.000Z (over 10 years ago)
- Last Synced: 2024-10-14T16:52:15.718Z (3 months ago)
- Language: Go
- Size: 203 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
`appengine-value` is a simple utility library to handle simple secret configuration values in an App Engine app.
Problem
-----Your app requires secret values (OAuth secrets, API keys, passwords) and you rightly don't want to specify these values as consts in your source code.
**Don't do this!**
```
const (
clientID = "123456.clientaccount.foo"
clientSecret = "s8p3rs3cr1t"
)
```Solution
-----**Do this instead**
```
import value "github.com/ImJasonH/appengine-value"func doOAuth(c appengine.Context) {
clientID := value.Get(c, "client_id")
clientSecret := value.Get(c, "client_secret")
// use clientID and clientSecret
}
```If you have multiple values, you can **batch lookups**:
```
func doOAuth(c appengine.Context) {
vals := value.GetMulti(c, "client_id", "client_secret")
clientID, clientSecret := vals["client_id"], vals["client_secret"]
}
```Configuration
-----To set or unset values, use the admin UI which is served at `/_ah/value/admin` -- be sure to map this in your `app.yaml`:
```
handlers:
- url: /_ah/value/.*
script: _go_app
login: admin
```(You can always remove the URL mapping if you're done setting values)