config

package
v0.0.0-...-2487acb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2017 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Overview

主要提供配置加载功能,目前是从配置文件中进行配置加载

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProxyId            int
	UiDir              string
	HttpPort           string
	McPort             string
	McSocketRecvBuffer int
	McSocketSendBuffer int
	MotanPort          string
	MetaDataZKAddr     string
	MetaDataZKRoot     string
	LogInfo            string
	LogDebug           string
	LogProfile         string
	LogExpire          string
	// contains filtered or unexported fields
}

all data is read only

func NewConfigFromBytes

func NewConfigFromBytes(data []byte) (*Config, error)

func NewConfigFromFile

func NewConfigFromFile(file string) (*Config, error)

func (*Config) GetSection

func (c *Config) GetSection(name string) (Section, error)

func (*Config) GetSections

func (c *Config) GetSections() map[string]Section

func (*Config) String

func (c *Config) String() string

type Section

type Section map[string]string

func (Section) GetBool

func (s Section) GetBool(key string) (bool, error)

func (Section) GetBoolMust

func (s Section) GetBoolMust(key string, defaultVal bool) bool

func (Section) GetDupByPattern

func (s Section) GetDupByPattern(pattern string) Section

func (Section) GetFloat64

func (s Section) GetFloat64(key string) (float64, error)

func (Section) GetFloat64Must

func (s Section) GetFloat64Must(key string, defaultVal float64) float64

func (Section) GetInt64

func (s Section) GetInt64(key string) (int64, error)

func (Section) GetInt64Must

func (s Section) GetInt64Must(key string, defaultVal int64) int64

func (Section) GetString

func (s Section) GetString(key string) (string, error)

func (Section) GetStringMust

func (s Section) GetStringMust(key, defaultVal string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL