hush

package module
v0.0.0-...-b56b364 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2015 License: MIT Imports: 6 Imported by: 2

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") }


<h4>With Revel</h4>
* 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()}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hush

type Hush struct {
	// contains filtered or unexported fields
}

func Hushfile

func Hushfile() Hush

func (Hush) GetFloat

func (h Hush) GetFloat(key string) (float64, bool)

func (Hush) GetInt

func (h Hush) GetInt(key string) (int64, bool)

func (Hush) GetString

func (h Hush) GetString(key string) (string, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL