• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang jsconf.Conf类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/funkygao/jsconf.Conf的典型用法代码示例。如果您正苦于以下问题:Golang Conf类的具体用法?Golang Conf怎么用?Golang Conf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Conf类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Init

func (this *SyslogngInput) Init(config *conf.Conf) {
	this.ident = config.String("ident", "")
	if this.ident == "" {
		panic("empty ident")
	}
	this.addr = config.String("addr", ":9787")
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:7,代码来源:syslogng_input.go


示例2: load

func (this *esConverter) load(section *conf.Conf) {
	this.keys = section.StringList("keys", nil)
	this.typ = section.String("type", "")
	this.currency = section.String("currency", "")
	this.rang = section.IntList("range", nil)
	this.normalizers = section.StringList("normalizers", nil)
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:7,代码来源:es_filter.go


示例3: Init

func (this *EsFilter) Init(config *conf.Conf) {
	this.ident = config.String("ident", "")
	if this.ident == "" {
		panic("empty ident")
	}
	this.converters = make([]esConverter, 0, 10)
	this.indexPattern = config.String("index_pattern", "")
	for i := 0; i < len(config.List("converts", nil)); i++ {
		section, err := config.Section(fmt.Sprintf("%s[%d]", "converts", i))
		if err != nil {
			panic(err)
		}

		c := esConverter{}
		c.load(section)
		this.converters = append(this.converters, c)
	}

	geodbFile := config.String("geodbfile", "")
	if err := als.LoadGeoDb(geodbFile); err != nil {
		panic(err)
	}
	globals := engine.Globals()
	if globals.Verbose {
		globals.Printf("Loaded geodb %s\n", geodbFile)
	}
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:27,代码来源:es_filter.go


示例4: loadConfig

func (this *ConfigMysqlServer) loadConfig(section *conf.Conf) {
	this.Pool = section.String("pool", "")
	this.Host = section.String("host", "")
	this.Port = section.String("port", "3306")
	this.DbName = section.String("db", "")
	this.User = section.String("username", "")
	this.Pass = section.String("password", "")
	this.Charset = section.String("charset", "utf8")
	if this.Host == "" ||
		this.Port == "" ||
		this.Pool == "" ||
		this.DbName == "" {
		panic("required field missing")
	}

	this.dsn = ""
	if this.User != "" {
		this.dsn = this.User + ":"
		if this.Pass != "" {
			this.dsn += this.Pass
		}
	}
	this.dsn += fmt.Sprintf("@tcp(%s:%s)/%s?", this.Host, this.Port, this.DbName)
	if this.Charset != "" {
		this.dsn += "charset=" + this.Charset
	}
	if this.conf.Timeout > 0 {
		this.dsn += "&timeout=" + this.conf.Timeout.String()
	}
}
开发者ID:lucmichalski,项目名称:fae,代码行数:30,代码来源:mysql.go


示例5: Init

func (this *CardinalityOutput) Init(config *conf.Conf) {
	this.checkpoint = config.String("checkpoint", "")
	this.counters = stats.NewCardinalityCounter()
	if this.checkpoint != "" {
		this.counters.Load(this.checkpoint)
	}
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:7,代码来源:cardinality_output.go


示例6: Init

func (this *SelfSysInput) Init(config *conf.Conf) {
	this.stopChan = make(chan bool)
	this.ident = config.String("ident", "")
	if this.ident == "" {
		panic("empty ident")
	}
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:7,代码来源:selfsys_input_darwin.go


示例7: LoadConfig

func (this *ConfigLock) LoadConfig(cf *conf.Conf) {
	this.MaxItems = cf.Int("max_items", 1<<20)
	this.Expires = cf.Duration("expires", time.Second*10)

	this.enabled = true

	log.Debug("lock conf: %+v", *this)
}
开发者ID:lucmichalski,项目名称:fae,代码行数:8,代码来源:lock.go


示例8: LoadConfig

func (this *Engine) LoadConfig(cf *conf.Conf) *Engine {
	config.LoadEngineConfig(cf)

	if section, err := cf.Section("plugin"); err == nil {
		plugin.LoadPlugins(section)
	}
	return this
}
开发者ID:lucmichalski,项目名称:fae,代码行数:8,代码来源:engine.go


示例9: Init

func (this *FlashlogInput) Init(config *conf.Conf) {
	this.dsn = config.String("dsn",
		"flashlog:[email protected](/var/run/mysqld/mysqld.sock)/flashlog?charset=utf8")
	this.ident = config.String("ident", "")
	if this.ident == "" {
		panic("empty ident")
	}
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:8,代码来源:flashlog_input.go


示例10: loadConfig

func loadConfig(cf *conf.Conf) {
	config.etcServers = cf.StringList("etcd_servers", nil)
	config.faeTemplateFile = cf.String("fae_template_file", "")
	config.faeTargetFile = cf.String("fae_target_file", "")
	config.maintainTemplateFile = cf.String("maintain_template_file", "")
	config.maintainTargetFile = cf.String("maintain_target_file", "")

	log.Debug("config: %+v", config)
}
开发者ID:lucmichalski,项目名称:fae,代码行数:9,代码来源:option.go


示例11: loadPluginSection

func (this *EngineConfig) loadPluginSection(section *conf.Conf) {
	pluginCommons := new(pluginCommons)
	pluginCommons.load(section)
	if pluginCommons.disabled {
		Globals().Printf("[%s]disabled\n", pluginCommons.name)

		return
	}

	wrapper := new(PluginWrapper)
	var ok bool
	if wrapper.pluginCreator, ok = availablePlugins[pluginCommons.class]; !ok {
		pretty.Printf("allPlugins: %# v\n", availablePlugins)
		panic("unknown plugin type: " + pluginCommons.class)
	}
	wrapper.configCreator = func() *conf.Conf { return section }
	wrapper.name = pluginCommons.name

	plugin := wrapper.pluginCreator()
	plugin.Init(section)

	pluginCats := pluginTypeRegex.FindStringSubmatch(pluginCommons.class)
	if len(pluginCats) < 2 {
		panic("invalid plugin type: " + pluginCommons.class)
	}

	pluginCategory := pluginCats[1]
	if pluginCategory == "Input" {
		this.InputRunners[wrapper.name] = NewInputRunner(wrapper.name, plugin.(Input),
			pluginCommons)
		this.inputWrappers[wrapper.name] = wrapper
		if pluginCommons.ticker > 0 {
			this.InputRunners[wrapper.name].setTickLength(time.Duration(pluginCommons.ticker) * time.Second)
		}

		return
	}

	foRunner := NewFORunner(wrapper.name, plugin, pluginCommons)
	matcher := NewMatcher(section.StringList("match", nil), foRunner)
	foRunner.matcher = matcher

	switch pluginCategory {
	case "Filter":
		this.router.addFilterMatcher(matcher)
		this.FilterRunners[foRunner.name] = foRunner
		this.filterWrappers[foRunner.name] = wrapper

	case "Output":
		this.router.addOutputMatcher(matcher)
		this.OutputRunners[foRunner.name] = foRunner
		this.outputWrappers[foRunner.name] = wrapper
	}
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:54,代码来源:engine.go


示例12: loadConfig

func (this *ConfigMemcacheServer) loadConfig(section *conf.Conf) {
	this.host = section.String("host", "")
	if this.host == "" {
		panic("Empty memcache server host")
	}
	this.hort = section.String("port", "")
	if this.hort == "" {
		panic("Empty memcache server port")
	}

	log.Debug("memcache server: %+v", *this)
}
开发者ID:justinblah,项目名称:fae,代码行数:12,代码来源:memcache.go


示例13: load

func (this *pluginCommons) load(section *conf.Conf) {
	this.name = section.String("name", "")
	if this.name == "" {
		pretty.Printf("%# v\n", *section)
		panic(fmt.Sprintf("invalid plugin config: %v", *section))
	}

	this.class = section.String("class", "")
	if this.class == "" {
		this.class = this.name
	}
	this.comment = section.String("comment", "")
	this.ticker = section.Int("ticker_interval", Globals().TickerLength)
	this.disabled = section.Bool("disabled", false)
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:15,代码来源:engine.go


示例14: loadConfig

func (this *ConfigRedisServer) loadConfig(cf *conf.Conf) {
	this.Addr = cf.String("addr", "")
	if this.Addr == "" {
		panic("Empty redis server addr")
	}
	this.MaxIdle = cf.Int("max_idle", 10)
	this.MaxActive = cf.Int("max_active", this.MaxIdle*2)
	this.IdleTimeout = cf.Duration("idle_timeout", 10*time.Minute)
}
开发者ID:lucmichalski,项目名称:fae,代码行数:9,代码来源:redis.go


示例15: loadConfig

func (this *configRpc) loadConfig(section *conf.Conf) {
	this.listenAddr = section.String("listen_addr", "")
	if this.listenAddr == "" {
		panic("Empty listen_addr")
	}

	this.clientTimeout = time.Duration(section.Int("client_timeout", 0)) * time.Second
	this.framed = section.Bool("framed", false)
	this.protocol = section.String("protocol", "binary")

	log.Debug("rpc: %+v", *this)
}
开发者ID:jlyt898,项目名称:fae,代码行数:12,代码来源:config.go


示例16: LoadPlugins

func LoadPlugins(cf *conf.Conf) {
	for i := 0; i < PackRecyclePoolSize; i++ {
		pack := NewPipelinePack(packRecycleChan)
		packRecycleChan <- pack
	}
	for i := 0; i < len(cf.List("plugins", nil)); i++ {
		section, err := cf.Section(fmt.Sprintf("plugins[%d]", i))
		if err != nil {
			panic(err)
		}

		name := section.String("name", "")
		if name == "" {
			panic("empty plugin name")
		}

		loadOnePlugin(name, section)
	}
}
开发者ID:lucmichalski,项目名称:fae,代码行数:19,代码来源:plugin.go


示例17: Init

func (this *AlarmOutput) Init(config *conf.Conf) {
	this.stopChan = make(chan interface{})
	this.projects = make(map[string]alarmProjectConf)
	for i := 0; i < len(config.List("projects", nil)); i++ {
		section, err := config.Section(fmt.Sprintf("projects[%d]", i))
		if err != nil {
			panic(err)
		}

		project := alarmProjectConf{}
		project.stopChan = this.stopChan
		project.fromConfig(section)
		if _, present := this.projects[project.name]; present {
			panic("dup project: " + project.name)
		}
		this.projects[project.name] = project
	}
	if len(this.projects) == 0 {
		panic("empty projects")
	}
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:21,代码来源:alarm_output.go


示例18: LoadServants

func LoadServants(cf *conf.Conf) {
	// mongodb section
	Servants.Mongodb = new(ConfigMongodb)
	section, err := cf.Section("mongodb")
	if err != nil {
		panic(err)
	}
	Servants.Mongodb.loadConfig(section)

	// memcached section
	Servants.Memcache = new(ConfigMemcache)
	section, err = cf.Section("memcache")
	if err != nil {
		panic(err)
	}
	Servants.Memcache.loadConfig(section)

	// lcache section
	Servants.Lcache = new(ConfigLcache)
	section, err = cf.Section("lcache")
	if err != nil {
		panic(err)
	}
	Servants.Lcache.loadConfig(section)
}
开发者ID:jlyt898,项目名称:fae,代码行数:25,代码来源:config.go


示例19: LoadConfig

func (this *ConfigRedis) LoadConfig(cf *conf.Conf) {
	section, err := cf.Section("breaker")
	if err == nil {
		this.Breaker.loadConfig(section)
	}

	this.Servers = make(map[string]map[string]*ConfigRedisServer)
	for i := 0; i < len(cf.List("pools", nil)); i++ {
		section, err := cf.Section(fmt.Sprintf("pools[%d]", i))
		if err != nil {
			panic(err)
		}

		pool := section.String("name", "")
		if pool == "" {
			panic("Empty redis pool name")
		}

		this.Servers[pool] = make(map[string]*ConfigRedisServer)

		// get servers in each pool
		for j := 0; j < len(section.List("servers", nil)); j++ {
			server, err := section.Section(fmt.Sprintf("servers[%d]", j))
			if err != nil {
				panic(err)
			}

			redisServer := new(ConfigRedisServer)
			redisServer.loadConfig(server)
			this.Servers[pool][redisServer.Addr] = redisServer
		}
	}

	log.Debug("redis conf: %+v", *this)
}
开发者ID:lucmichalski,项目名称:fae,代码行数:35,代码来源:redis.go


示例20: init

func (this *alarmWorkerConfigField) init(config *conf.Conf) {
	this.name = config.String("name", "")
	if this.name == "" {
		panic("alarm worker field name can't be empty")
	}

	this.typ = config.String("type", als.KEY_TYPE_STRING)
	this.parser = config.String("parser", "")
	this.ignores = config.StringList("ignores", nil)
	this._regexIgnores = make([]*regexp.Regexp, 0)
	// build the precompiled regex matcher
	for _, ignore := range this.ignores {
		if strings.HasPrefix(ignore, "regex:") {
			pattern := strings.TrimSpace(ignore[6:])
			r, err := regexp.Compile(pattern)
			if err != nil {
				panic(err)
			}

			this._regexIgnores = append(this._regexIgnores, r)
		}
	}
	this.normalizers = config.StringList("normalizers", nil)
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:24,代码来源:alarm_worker.go



注:本文中的github.com/funkygao/jsconf.Conf类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang log4go.Debug函数代码示例发布时间:2022-05-23
下一篇:
Golang httprouter.Params类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap