Back to / internal

Package internal

Latest Go to latest

The latest major version is .

Published: Sep 4, 2020 | License: Apache-2.0 | Module:



const (
	KeyAppConfig     = ""
	KeyApolloConfig  = "chassix.apollo"
	KeyServerConfig  = "chassix.server"
	KeyLoggingConfig = "chassix.logging"


var ConfigFileEnvKey = "CHASSIX_CONF"
var IsDebug bool

func GetLogger

func GetLogger() *logx.Entry

func IsApolloEnabled

func IsApolloEnabled() bool

IsApolloEnabled is apollo enable

func Load

func Load()

func LoadChassixConfigs

func LoadChassixConfigs(cfgs []interface{})

func LoadConfigsFromEnvFile

func LoadConfigsFromEnvFile(cfgs map[string]interface{}) error

LoadConfigsFromFile from file

func LoadCustomFromApollo

func LoadCustomFromApollo(customCfg interface{}, settings *apollo.Conf) error

LoadCustomFromFile Load custom config from apollo, save to custom config

func LoadCustomFromFile

func LoadCustomFromFile(customCfg interface{}, fileName string) error

LoadCustomFromFile Load custom config from file, save to custom config

func LoadFromApollo

func LoadFromApollo(cfg interface{}, settings *apollo.Conf, configs []interface{})

func LoadFromEnvFile

func LoadFromEnvFile(cfg interface{})

LoadEnvFile Load config from the file that path is saved in os env.

func LoadFromFile

func LoadFromFile(cfg interface{}, fileName string) error

LoadFromFile from file

func LoadSimpleConfig

func LoadSimpleConfig()

func UsingApollo

func UsingApollo()

func UsingYaml

func UsingYaml()


func Watch

func Watch(name string, cfg interface{})

func WatchBootstrapConfig

func WatchBootstrapConfig()

type ApolloConfig

type ApolloConfig struct {
	Data struct {
		Enabled  bool        `yaml:"enabled"`
		Settings apollo.Conf `yaml:"settings"`
	} `yaml:"apollo"`

ApolloConfig apollo config

type AppConfig

type AppConfig struct {
	Data struct {
		Name    string
		Version string
		Env     string
		Debug   bool
	} `yaml:"app"`

AppConfig application config

func App

func App() *AppConfig

App app config

type Config

type Config struct {
	AppConfig `yaml:",inline"`
	//Server ServerConfig `yaml:"server"`
	ApolloConfig `yaml:",inline"`

Config all config

type Configs

type Configs struct {
	// contains filtered or unexported fields

func (*Configs) Apollo

func (c *Configs) Apollo() *ApolloConfig

Apollo apollo server settings: ip, namespaces...

func (*Configs) App

func (c *Configs) App() *AppConfig

App return app config

func (*Configs) Get

func (c *Configs) Get(key string) (interface{}, bool)

Get get config by map key

func (*Configs) Lock

func (c *Configs) Lock()

func (*Configs) Logging

func (c *Configs) Logging() *LoggingConfig

Logging logging config

func (*Configs) RLock

func (c *Configs) RLock()

func (*Configs) RUnlock

func (c *Configs) RUnlock()

func (*Configs) Server

func (c *Configs) Server() *ServerConfig

Server get server config: port addr

func (*Configs) UnLock

func (c *Configs) UnLock()

func (*Configs) Watch

func (c *Configs) Watch(name string, cfg interface{})

type HotReLoader

type HotReLoader struct {
	Config interface{}
	Func   func(cfg interface{})

type LoggingConfig

type LoggingConfig struct {
	Data struct {
		Level        string
		ReportCaller bool `yaml:"report_caller"`
		NoColors     bool `yaml:"no_colors"`
		CallerFirst  bool `yaml:"caller_first"`
	} `yaml:"logging"`

func Logging

func Logging() *LoggingConfig

func (*LoggingConfig) CallerFirst

func (logCfg *LoggingConfig) CallerFirst() bool

func (*LoggingConfig) Level

func (logCfg *LoggingConfig) Level() int

func (*LoggingConfig) NoColors

func (logCfg *LoggingConfig) NoColors() bool

func (*LoggingConfig) ReportCaller

func (logCfg *LoggingConfig) ReportCaller() bool

type ServerConfig

type ServerConfig struct {
	Data ServerConfigData `yaml:"server"`

ServerConfig server config

func Server

func Server() *ServerConfig

Server server config

type ServerConfigData

type ServerConfigData struct {
	Port int
	Addr string


Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier