https://github.com/caneroj1/hush
go pkg for reading in config values
https://github.com/caneroj1/hush
Last synced: about 2 months ago
JSON representation
go pkg for reading in config values
- Host: GitHub
- URL: https://github.com/caneroj1/hush
- Owner: caneroj1
- License: mit
- Created: 2015-08-24T00:47:38.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-25T00:21:11.000Z (over 9 years ago)
- Last Synced: 2025-02-03T11:37:07.123Z (4 months ago)
- Language: Go
- Size: 137 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Hush
This a Go package for reading in a config file and providing access to the
config settings.Hush reads from a local file called a .hushfile. You can have things in the
.hushfile like:```
super_secret_key: abcdefghijklmnopqrstuvwxyz
secret_app_number: 42
```It's probably a good idea to add the .hushfile to your .gitignore.
Still a WIP!!
* If you are using Hush without Revel, just put the .hushfile in the same directory from where you are running a Go program.
* If you are using Hush with Revel, put your .hushfile in the app/ directory or in the conf/ directory and be sure to call `revel run yourapp` from the root directory of yourapp.
How to Use Hush
Without Revel
```
package mainimport "github.com/caneroj1/hush"
var secrets hush.Hush
func main() {
secrets = hush.Hushfile()
key, ok := secrets.GetString("super_secret_key")
}
```With Revel
* In init.go:
```
package appimport (
"github.com/caneroj1/hush"
"github.com/revel/revel"
)var secrets hush.Hush
func init() {
// Filters is the default set of global filters.
revel.Filters = []revel.Filter{
... // omitted code
}// register startup functions with OnAppStart
// ( order dependent )
secrets = hush.Hushfile()}
```