config

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProdEnv  = "production" // 线上环境
	BetaEnv  = "beta"       // beta环境
	DevEnv   = "develop"    // 开发环境
	LocalEnv = "local"      // 本地环境
)

Variables

This section is empty.

Functions

func GetEnv

func GetEnv() string

当前环境,默认本地开发

func IsDebug

func IsDebug() bool

是否调试模式

func IsEnvEqual

func IsEnvEqual(env string) bool

是否当前环境

Types

type Config

type Config struct {
	ServiceName             string             `toml:"ServiceName"`
	Env                     string             `toml:"Env"`
	Debug                   bool               `toml:"Debug"`
	PrometheusCollectEnable bool               `toml:"PrometheusCollectEnable"`
	SkyWalkingOapServer     string             `toml:"SkyWalkingOapServer"`
	Log                     config.LogConfig   `toml:"Log"`
	Redis                   config.RedisConfig `toml:"Redis"`
	Mns                     config.MnsConfig   `toml:"AliMns"`
	Db                      config.DbConfig    `toml:"Db"`
	Api                     config.ApiConfig   `toml:"Api"`
}

------------------------配置文件解析

func GetConf

func GetConf() *Config

当前配置

func Load

func Load(path string) (*Config, error)

------------------------ 加载配置 ------------------------//

type Options

type Options struct {
	ShowVersion bool
	Cmd         string
	ConfFile    string
	App         string
	PidDir      string
	Queue       string
	Command     string
}

------------------------启动命令配置

func GetOptions

func GetOptions() *Options

获取启动命令配置

func (*Options) GenPidFile added in v1.0.5

func (opts *Options) GenPidFile() string

pid进程号的保存路径

Jump to

Keyboard shortcuts

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