本文整理汇总了Golang中github.com/astaxie/beego/config.ConfigContainer类的典型用法代码示例。如果您正苦于以下问题:Golang ConfigContainer类的具体用法?Golang ConfigContainer怎么用?Golang ConfigContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigContainer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: qiniugetconfig
func qiniugetconfig(conffile string) (err error) {
var conf config.ConfigContainer
conf, err = config.NewConfig("ini", conffile)
if err != nil {
return err
}
g_qiniuEndpoint = conf.String("qiniucloud::endpoint")
if g_qiniuEndpoint == "" {
return errors.New("read config file's endpoint failed!")
}
g_qiniuBucket = conf.String("qiniucloud::bucket")
if g_qiniuBucket == "" {
return errors.New("read config file's bucket failed!")
}
g_qiniuAccessKeyID = conf.String("qiniucloud::accessKeyID")
if g_qiniuAccessKeyID == "" {
return errors.New("read config file's accessKeyID failed!")
}
g_qiniuAccessKeySecret = conf.String("qiniucloud::accessKeysecret")
if g_qiniuAccessKeySecret == "" {
return errors.New("read config file's accessKeysecret failed!")
}
return nil
}
开发者ID:haoyuist,项目名称:dockyard,代码行数:28,代码来源:qiniu.go
示例2: qcloudSetconfig
func qcloudSetconfig(conf config.ConfigContainer) error {
QcloudEndpoint = conf.String("qcloud::endpoint")
if QcloudEndpoint == "" {
return fmt.Errorf("Read endpoint of qcloud failed!")
}
QcloudAccessID = conf.String("qcloud::accessID")
if QcloudAccessID == "" {
return fmt.Errorf("Read accessID of qcloud failed!")
}
QcloudBucket = conf.String("qcloud::bucket")
if QcloudBucket == "" {
return fmt.Errorf("Read bucket qcloud failed!")
}
QcloudAccessKeyID = conf.String("qcloud::accessKeyID")
if QcloudAccessKeyID == "" {
return fmt.Errorf("Read accessKeyID of qcloud failed!")
}
QcloudAccessKeySecret = conf.String("qcloud::accessKeysecret")
if QcloudAccessKeySecret == "" {
return fmt.Errorf("Read accessKeysecret of qcloud failed!")
}
return nil
}
开发者ID:CodeJuan,项目名称:dockyard,代码行数:27,代码来源:qcloud.go
示例3: upgetconfig
func upgetconfig(conffile string) (err error) {
var conf config.ConfigContainer
conf, err = config.NewConfig("ini", conffile)
if err != nil {
return err
}
g_upEndpoint = conf.String("upCloud::endpoint")
if g_upEndpoint == "" {
return errors.New("read config file's endpoint failed!")
}
g_upBucket = conf.String("upCloud::bucket")
if g_upBucket == "" {
return errors.New("read config file's bucket failed!")
}
g_upUser = conf.String("upCloud::user")
if g_upUser == "" {
return errors.New("read config file's user failed!")
}
g_upPasswd = conf.String("upCloud::passwd")
if g_upPasswd == "" {
return errors.New("read config file's passwd failed!")
}
return nil
}
开发者ID:haoyuist,项目名称:dockyard,代码行数:29,代码来源:upyun.go
示例4: ParseConfig
//Parses Config to struct with beego AppConfig
func ParseConfig(beeConf config.ConfigContainer, obj interface{}) error {
val := reflect.ValueOf(obj)
if !val.CanAddr() && val.Kind() != reflect.Ptr {
return errors.New(NOT_PTR)
}
val = val.Elem()
tp := val.Type()
for i := 0; i < val.NumField(); i++ {
//Get Config tag
tag := tp.Field(i).Tag.Get(CONF_TAG)
if tag == "" {
continue
}
v := val.Field(i)
//Type casting
switch v.Interface().(type) {
case bool:
b, err := beeConf.Bool(tag)
if err != nil {
return err
}
v.SetBool(b)
case int, int64:
b, err := beeConf.Int(tag)
if err != nil {
return err
}
v.SetInt(int64(b))
case float64:
b, err := beeConf.Float(tag)
if err != nil {
return err
}
v.SetFloat(b)
case string:
v.SetString(beeConf.String(tag))
default:
return errors.New(UNSUPPORTED_TYPE)
}
}
return nil
}
开发者ID:grr89,项目名称:hrkb,代码行数:53,代码来源:conf.go
示例5: amazons3Setconfig
func amazons3Setconfig(conf config.ConfigContainer) error {
Amazons3Endpoint = conf.String("amazons3::endpoint")
if Amazons3Endpoint == "" {
return fmt.Errorf("Read endpoint of amazons3 failed!")
}
Amazons3Bucket = conf.String("amazons3::bucket")
if Amazons3Bucket == "" {
return fmt.Errorf("Read bucket of amazons3 failed!")
}
Amazons3AccessKeyID = conf.String("amazons3::accessKeyID")
if Amazons3AccessKeyID == "" {
return fmt.Errorf("Read accessKeyID of amazons3 failed!")
}
Amazons3AccessKeySecret = conf.String("amazons3::accessKeysecret")
if Amazons3AccessKeySecret == "" {
return fmt.Errorf("Read accessKeysecret of amazons3 failed!")
}
return nil
}
开发者ID:Issacpeng,项目名称:dockyard,代码行数:22,代码来源:amazons3.go
示例6: Initialize
func Initialize(env string, cc config.ConfigContainer) (r App, err error) {
r.Db.Driver = cc.String(env + "::driver")
r.Db.Postgres.Host = cc.String(env + "::pghost")
r.Db.Postgres.Database = cc.String(env + "::pgdb")
r.Db.Postgres.User = cc.String(env + "::pguser")
r.Db.Postgres.Pass = cc.String(env + "::pgpass")
r.Log.Dist = cc.String("log::dist")
if r.Log.Dist == "file" {
r.Log.File.Minutes, err = cc.Int("log::minutes")
if err != nil {
return
}
r.Log.File.Ext = cc.String("log::ext")
r.Log.File.Folder = cc.String("log::folder")
}
return
}
开发者ID:grr89,项目名称:hrkb,代码行数:21,代码来源:conf.go
注:本文中的github.com/astaxie/beego/config.ConfigContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论