Last active
August 29, 2015 14:06
-
-
Save hirokazumiyaji/a366d6f4da6fdf1d4c4a to your computer and use it in GitHub Desktop.
go configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package go | |
import ( | |
"io/ioutil" | |
"github.com/gonuts/yaml" | |
) | |
var Config = make(map[string]interface{}) | |
func Load(yamlFile string) (err error) { | |
if yamlFile == "" { | |
yamlFile = "config.yaml" | |
} | |
buffer, err := ioutil.ReadFile(yamlFile) | |
if err != nil { | |
return err | |
} | |
err = yaml.Unmarshal(buffer, &Config) | |
if err != nil { | |
return err | |
} | |
return err | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
databases: | |
default: | |
dbname: 'default' | |
host: 'localhost' | |
port: 3393 | |
username: 'root' | |
password: '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment