config

package
v1.8.39 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Zlib Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	EProd = "prod"
	ETest = "test"
	EDev  = "dev"
)
View Source
const (
	KForever  = "forever"
	KDaemon   = "daemon"
	KPprof    = "pprof"
	KPath     = "path"
	KEnv      = "env"
	KConf     = "conf"
	KDataPath = "dataPath"
	KAppId    = "appid"
)

Variables

View Source
var (
	Version  = "1.0.0"
	AppName  = "unknown"
	AppAlias = "" //别名,example 某某公司的某某应用
	AppId    string
	SeqId    int64 = 0
	Source   string
	Env      = EDev
	WorkDir  string
	MainConf string
	DataPath string //程序存储数据
	Daemon   bool
	Forever  bool
	Pprof    bool
)

Functions

func Close added in v1.8.0

func Close()

func Closed added in v1.8.0

func Closed() <-chan bool

func FileNameInAppDataPath added in v1.2.20

func FileNameInAppDataPath(name string) string

FileNameInAppDataPath conf/ "{workdir}/name" 或 {workdir}/app/name

func FileNameInAppDataPathV2 added in v1.2.20

func FileNameInAppDataPathV2(name string) string

FileNameInAppDataPathV2 conf/ "{workdir}/app/name"

func FileNameInConfPath added in v1.1.6

func FileNameInConfPath(name string) string

FileNameInConfPath conf/ "confPath/name"

func FileNameInDataPath added in v1.6.11

func FileNameInDataPath(name string) string

FileNameInDataPath conf/ 目录下 "{DataPath}/name"

func FileNameInEnvDataPath added in v1.6.11

func FileNameInEnvDataPath(name string) string

FileNameInEnvDataPath conf/ 目录下 "{DataPath}/{Env}/name"

func FileNameInEnvPath added in v1.1.6

func FileNameInEnvPath(name string) string

FileNameInEnvPath env/{Env}/name

func FileNameWithEnvInConfAppPath added in v1.1.6

func FileNameWithEnvInConfAppPath(name string) string

FileNameWithEnvInConfAppPath conf/appName 带env "conf/{appName}/{Env}.name"

func FileNameWithEnvInDataPath added in v1.6.11

func FileNameWithEnvInDataPath(name string) string

FileNameWithEnvInDataPath conf/ 目录下 "{DataPath}/{Env}.name"

func FileNameWithoutEnvInConfAppPath added in v1.1.6

func FileNameWithoutEnvInConfAppPath(name string) string

FileNameWithoutEnvInConfAppPath conf/appName 不带env "conf/{appName}/name"

func FileNameWithoutEnvInEnvPath added in v1.1.6

func FileNameWithoutEnvInEnvPath(name string) string

FileNameWithoutEnvInEnvPath env/name

func GetAppDataPath added in v1.1.6

func GetAppDataPath() string

GetAppDataPath 程序运行数据目录,如views,docs

func GetAppDataPathV2 added in v1.2.20

func GetAppDataPathV2() string

func GetConfAppPath added in v1.1.6

func GetConfAppPath() string

GetConfAppPath ./conf/appName

func GetConfPath added in v1.1.6

func GetConfPath() string

GetConfPath ./conf

func GetDataPath added in v1.1.6

func GetDataPath() string

GetDataPath 业务定义存储路径

func GetEnvPath added in v1.1.6

func GetEnvPath() string

func GetExecPath added in v1.3.20

func GetExecPath() string

func IsDevEnvironment added in v1.0.51

func IsDevEnvironment() bool

func IsProdEnvironment added in v1.0.51

func IsProdEnvironment() bool

func IsTestEnvironment added in v1.0.51

func IsTestEnvironment() bool

func MainFileName added in v1.1.6

func MainFileName() string

MainFileName env.main.json 全路径文件名

func UseAppDataPathV2 added in v1.1.6

func UseAppDataPathV2()

func UseDataVersion added in v1.3.19

func UseDataVersion(ver int)

func WithEnv added in v1.6.11

func WithEnv(name string) string

WithEnv 与env组合

Types

type Config

type Config struct {
	Mode         string `json:"mode" yaml:"mode" xml:"mode"`
	Server       string `json:"server" yaml:"server" xml:"server"`
	PubIP        string `json:"publicIp" yaml:"publicIp" xml:"publicIp"`
	DataVersion  int    `json:"dataVersion" yaml:"dataVersion" xml:"dataVersion"`
	EnabledRedis bool   `json:"enabledRedis" yaml:"enabledRedis" xml:"enabledRedis"`
	EnabledDb    bool   `json:"enabledDb" yaml:"enabledDb" xml:"enabledDb"`
	EnabledEs    bool   `json:"enabledEs" yaml:"enabledEs" xml:"enabledEs"`
	EnabledMQ    bool   `json:"enabledMQ" yaml:"enabledMQ" xml:"enabledMQ"`
}

func (*Config) Init

func (*Config) Init()

Jump to

Keyboard shortcuts

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