2 Star 1 Fork 1

极速代码 / dcmp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
config.go 582 Bytes
一键复制 编辑 原始数据 按行查看 历史
silenceper 提交于 2017-02-22 22:56 . base_path support config #9
package main
import (
"io/ioutil"
"path/filepath"
"gopkg.in/yaml.v1"
)
type config struct {
Listen string `yaml:"listen"`
Endpoints []string `yaml:"endpoints"`
BasePath string `yaml:"base_path"`
CaFile string `yaml:"ca_file"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
}
func getConfig() *config {
filename, _ := filepath.Abs("./config/config.yml")
yamlFile, err := ioutil.ReadFile(filename)
if err != nil {
panic(err)
}
var c *config
err = yaml.Unmarshal(yamlFile, &c)
if err != nil {
panic(err)
}
return c
}
JavaScript
1
https://gitee.com/andy521/dcmp.git
git@gitee.com:andy521/dcmp.git
andy521
dcmp
dcmp
master

搜索帮助