当前位置: 首页>>代码示例>>Golang>>正文


Golang jsconf.Conf类代码示例

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


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


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