apigen/config.go

25 lines
439 B
Go
Raw Normal View History

package main
import (
"flag"
"gopkg.in/yaml.v2"
"io/ioutil"
)
type Config struct {
Gofname string `yaml:"gofname"`
Goimpldir string `yaml:"goimpldir"`
Tsfname string `json:"tsfname"`
}
var config Config
func loadConfig() {
fname := flag.String("f", ".apigen.yaml", "File with config to load - defaults to '.apigen'")
flag.Parse()
bs, err := ioutil.ReadFile(*fname)
Err(err)
err = yaml.Unmarshal(bs, &config)
Err(err)
}