本文整理汇总了Golang中github.com/funkygao/jsconf.Conf.StringList方法的典型用法代码示例。如果您正苦于以下问题:Golang Conf.StringList方法的具体用法?Golang Conf.StringList怎么用?Golang Conf.StringList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/funkygao/jsconf.Conf
的用法示例。
在下文中一共展示了Conf.StringList方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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)
}
示例2: 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)
}
示例3: 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
}
}
示例4: Init
func (this *ArchiveInput) Init(config *conf.Conf) {
this.rootDir = config.String("root_dir", "")
this.ident = config.String("ident", "")
if this.ident == "" {
panic("empty ident")
}
this.project = config.String("project", "rs")
this.workerNChan = make(chan int, config.Int("concurrent_num", 20))
this.chkpnt = als.NewFileCheckpoint(config.String("chkpntfile", ""))
this.ignores = config.StringList("ignores", nil)
}
示例5: load
func (this *cardinalityConverter) load(section *conf.Conf) {
this.logPrefix = section.String("log_prefix", "")
this.project = section.String("project", "")
this.fields = make([]cardinalityField, 0, 5)
for i := 0; i < len(section.List("fields", nil)); i++ {
keyPrefix := fmt.Sprintf("fields[%d].", i)
field := cardinalityField{}
field.key = section.String(keyPrefix+"key", "")
field.typ = section.String(keyPrefix+"type", "string")
field.intervals = section.StringList(keyPrefix+"intervals", nil)
this.fields = append(this.fields, field)
}
}
示例6: LoadConfig
func (this *ConfigMysql) LoadConfig(cf *conf.Conf) {
this.GlobalPools = make(map[string]bool)
for _, p := range cf.StringList("global_pools", nil) {
this.GlobalPools[p] = true
}
this.ShardStrategy = cf.String("shard_strategy", "standard")
this.MaxIdleTime = cf.Duration("max_idle_time", 0)
this.Timeout = cf.Duration("timeout", 10*time.Second)
this.AllowNullableColumns = cf.Bool("allow_nullable_columns", true)
this.MaxIdleConnsPerServer = cf.Int("max_idle_conns_per_server", 2)
this.MaxConnsPerServer = cf.Int("max_conns_per_server",
this.MaxIdleConnsPerServer*5)
this.CachePrepareStmtMaxItems = cf.Int("cache_prepare_stmt_max_items", 0)
this.HeartbeatInterval = cf.Int("heartbeat_interval", 120)
this.CacheStore = cf.String("cache_store", "mem")
this.CacheStoreMemMaxItems = cf.Int("cache_store_mem_max_items", 10<<20)
this.CacheStoreRedisPool = cf.String("cache_store_redis_pool", "db_cache")
this.CacheKeyHash = cf.Bool("cache_key_hash", false)
this.LookupPool = cf.String("lookup_pool", "ShardLookup")
this.JsonMergeMaxOutstandingItems = cf.Int("json_merge_max_outstanding_items", 8<<20)
this.LookupCacheMaxItems = cf.Int("lookup_cache_max_items", 1<<20)
section, err := cf.Section("breaker")
if err == nil {
this.Breaker.loadConfig(section)
}
section, err = cf.Section("lookup_tables")
if err == nil {
this.lookupTables = *section
} else {
panic(err)
}
this.Servers = make(map[string]*ConfigMysqlServer)
for i := 0; i < len(cf.List("servers", nil)); i++ {
section, err := cf.Section(fmt.Sprintf("servers[%d]", i))
if err != nil {
panic(err)
}
server := new(ConfigMysqlServer)
server.conf = this
server.loadConfig(section)
this.Servers[server.Pool] = server
}
log.Debug("mysql conf: %+v", *this)
}
示例7: init
func (this *alarmWorkerConfig) init(config *conf.Conf) {
this.camelName = config.String("camel_name", "")
if this.camelName == "" {
panic("empty 'camel_name'")
}
this.title = config.String("title", "")
if this.title == "" {
this.title = this.camelName
}
this.colors = config.StringList("colors", nil)
this.printFormat = config.String("printf", "")
this.instantFormat = config.String("iprintf", "")
if this.printFormat == "" && this.instantFormat == "" {
panic(fmt.Sprintf("%s empty 'printf' and 'iprintf'", this.title))
}
this.severity = config.Int("severity", 1)
this.windowSize = time.Duration(config.Int("window_size", 0)) * time.Second
this.showSummary = config.Bool("show_summary", false)
this.beepThreshold = config.Int("beep_threshold", 0)
this.abnormalBase = config.Int("abnormal_base", 10)
this.abnormalSeverityFactor = config.Int("abnormal_severity_factor", 2)
this.abnormalPercent = config.Float("abnormal_percent", 1.5)
this.dbName = config.String("dbname", "")
this.tableName = this.dbName // table name is db name
this.createTable = config.String("create_table", "")
this.insertStmt = config.String("insert_stmt", "")
this.statsStmt = config.String("stats_stmt", "")
this.fields = make([]alarmWorkerConfigField, 0, 5)
for i := 0; i < len(config.List("fields", nil)); i++ {
section, err := config.Section(fmt.Sprintf("fields[%d]", i))
if err != nil {
panic(err)
}
field := alarmWorkerConfigField{}
field.init(section)
this.fields = append(this.fields, field)
}
if len(this.fields) == 0 {
panic(fmt.Sprintf("%s empty 'fields'", this.title))
}
}
示例8: LoadConfig
func (this *ConfigEngine) LoadConfig(cf *conf.Conf) {
this.Conf = cf
this.HttpListenAddr = this.String("http_listen_addr", "")
this.PprofListenAddr = this.String("pprof_listen_addr", "")
this.DashboardListenAddr = this.String("dashboard_listen_addr", "")
this.MetricsLogfile = this.String("metrics_logfile", "metrics.log")
this.ReloadWatchdogInterval = this.Duration("reload_watchdog_interval", time.Second)
this.ServerMode = this.Bool("server_mode", true)
// rpc section
this.Rpc = new(ConfigRpc)
section, err := this.Section("rpc")
if err != nil {
panic(err)
}
this.Rpc.LoadConfig(section)
// servants section
this.Servants = new(ConfigServant)
section, err = this.Section("servants")
if err != nil {
panic(err)
}
this.Servants.LoadConfig(this.Rpc.ListenAddr, section)
// after load all configs, calculate EtcdSelfAddr
this.EtcdServers = cf.StringList("etcd_servers", nil)
if len(this.EtcdServers) > 0 {
this.EtcdSelfAddr = this.Rpc.ListenAddr
if strings.HasPrefix(this.EtcdSelfAddr, ":") {
// automatically get local ip addr
ips, _ := ip.LocalIpv4Addrs()
this.EtcdSelfAddr = ips[0] + this.EtcdSelfAddr
}
}
log.Debug("engine conf: %+v", *this)
}
示例9: LoadConfig
func (this *ConfigCouchbase) LoadConfig(cf *conf.Conf) {
this.Servers = cf.StringList("servers", nil)
log.Debug("couchbase conf: %+v", *this)
}
示例10: handleSection
// recursively
func handleSection(section *conf.Conf) {
ident := section.String(IDENT, "")
if ident != "" {
if _, present := graph[ident]; present {
fmt.Printf("ident[%s]duplicated\n", ident)
os.Exit(1)
}
ie := &identEntry{}
ie.matches = make([]string, 0, 10)
ie.disabled = section.Bool(DISABLED, false)
if section.StringList(MATCH, nil) == nil {
ie.isInput = true
}
graph[ident] = ie
pluginName := section.String(NAME, "")
if pluginName != "" {
identName[pluginName] = ident
}
}
matches := section.StringList(MATCH, nil)
if matches != nil {
pluginName := section.String(NAME, "")
if pluginName == "" {
fmt.Printf("plugin match %v has no 'name' key\n", matches)
os.Exit(1)
}
for _, id := range matches {
if _, present := graph[id]; present {
graph[id].matches = append(graph[id].matches, pluginName)
} else {
fmt.Printf("%15s -> %s\n", id, pluginName)
}
}
}
sub := section.Interface("", nil).(map[string]interface{})
if sub == nil {
return
}
for k, v := range sub {
if x, ok := v.([]interface{}); ok {
switch x[0].(type) {
case string, float64, int, bool, time.Time:
// this section will never find 'ident'
continue
}
for i := 0; i < len(section.List(k, nil)); i++ {
key := fmt.Sprintf("%s[%d]", k, i)
sec, err := section.Section(key)
if err != nil {
continue
}
handleSection(sec)
}
}
}
}