An open API service indexing awesome lists of open source software.

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

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 main

import "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 app

import (
"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()}
```