Skip to content

Instantly share code, notes, and snippets.

@xorl
Last active October 23, 2015 21:50
Show Gist options
  • Save xorl/f6ddee1484a52da05832 to your computer and use it in GitHub Desktop.
Save xorl/f6ddee1484a52da05832 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"path/filepath"
"gopkg.in/yaml.v2"
)
type Config struct {
Ops_params map[[]]Options
}
type Options struct {
environment string
lifecycle string
}
func main() {
filename, _ := filepath.Abs("/Users/rlewon/Projects/g/ops-config/hosts/vmhost99-uat.snc1.yml")
yamlFile, err := ioutil.ReadFile(filename)
if err != nil {
panic(err)
}
var config Config
err = yaml.Unmarshal(yamlFile, &config)
if err != nil {
panic(err)
}
fmt.Printf("Value: %#v\n", config.Ops_params)
}
params:
env: prod
life: live
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment