config

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Prod  = "prod"  // 线上
	Stage = "stage" // 预上线
	Test  = "test"  // 测试
	Dev   = "dev"   // 开发
)

app env type

Variables

This section is empty.

Functions

This section is empty.

Types

type Jaeger

type Jaeger struct {
	LogSQL        string `yaml:"log_sql"`
	SlowQueryTime int    `yaml:"slow_query_time"`
}

type Model

type Model struct {
	Env          string           `yaml:"env" env:"GINX_ENV"`
	LocalIP      string           `yaml:"-"`
	Hostname     string           `yaml:"-"`
	IdcName      string           `yaml:"-"`
	Name         string           `yaml:"name" env:"GINX_NAME"`
	Summary      string           `yaml:"summary" env:"GINX_SUMMARY"`
	HomeDir      string           `yaml:"home_dir" env:"GINX_HOME_DIR"`
	Mysql        mysqlDbModel     `yaml:"mysql_db"`
	Elastic      elasticSearch    `yaml:"elastic"`
	Redis        redisConfig      `yaml:"redis"`
	WebServerLog webServerLogConf `yaml:"web_server_log"`
	Log          logConf          `yaml:"log"`
	Grpc         grpcConfig       `yaml:"grpc"`
	HTTP         httpConfig       `yaml:"http"`
	HTTPS        httpsConfig      `yaml:"https"`
	ServerName   []string         `yaml:"server_name" env:"GINX_SERVER_NAME"`
	Task         taskConfig       `yaml:"task"`
	Tpl          tpl              `yaml:"tpl"`
	Auth         auth             `yaml:"auth"`
	Trace        Trace            `yaml:"trace"`
	PProf        pprof            `yaml:"pprof"`
	Metrics      metrics          `yaml:"metrics"`
	Cors         cors             `yaml:"cors"`

	APICallbackRegExp string `yaml:"api_callback_reg_exp"`
}

Model app global config model.

func Init

func Init(prjHome string) (Model, error)

Init 配置文件初始化

func (Model) GetHTTPSCertFile

func (m Model) GetHTTPSCertFile() string

GetHTTPSCertFile get project https cert file content.

func (Model) GetHTTPSKeyFile

func (m Model) GetHTTPSKeyFile() string

GetHTTPSKeyFile get https cert key file content.

func (*Model) MergeEnv

func (m *Model) MergeEnv()

MergeEnv merge yaml config and linux env same var.

type Trace

type Trace struct {
	Enable      bool     `yaml:"enable" env:"GINX_TRACE_ENABLE"`
	AgentServer string   `yaml:"agent_server" env:"GINX_TRACE_AGENT_SERVER"`
	Logger      string   `yaml:"logger" env:"GINX_TRACE_LOGGER"`
	SampleType  string   `yaml:"sample_type" env:"GINX_TRACE_SAMPLE_TYPE"`
	SampleParam float64  `yaml:"sample_param" env:"GINX_TRACE_SAMPLE_PARAM"`
	SkipPaths   []string `yaml:"skip_paths" env:"GINX_TRACE_SKIP_PATHS"`
}

Jump to

Keyboard shortcuts

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