Documentation ¶
Index ¶
- Constants
- Variables
- func FileNameInAppDataPath(name string) string
- func FileNameInAppDataPathV2(name string) string
- func FileNameInConfAppPath(name string) string
- func FileNameInConfPath(name string) string
- func FileNameInDataPath(name string) string
- func FileNameInEnvDataPath(name string) string
- func FileNameInEnvPath(name string) string
- func FileNameWithEnvInConfAppPath(name string) string
- func FileNameWithEnvInDataPath(name string) string
- func FileNameWithoutEnvInConfAppPath(name string) string
- func FileNameWithoutEnvInEnvPath(name string) string
- func GetAppDataPath() string
- func GetAppDataPathV2() string
- func GetConfAppPath() string
- func GetConfPath() string
- func GetDataPath() string
- func GetEnvPath() string
- func GetExecPath() string
- func IsDefaultDataPath() bool
- func IsDevEnvironment() bool
- func IsProdEnvironment() bool
- func IsTestEnvironment() bool
- func MainFileName() string
- func UseAppDataPathV2()
- func UseAppDataVersion(ver int)
- func WithEnv(name string) string
- type Config
- type HandlerFunc
- type Option
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 )
View Source
var RegisterConfig func(ty string, handler HandlerFunc)
View Source
var UnRegisterConfig func(ty string)
Functions ¶
func FileNameInAppDataPath ¶ added in v1.2.20
FileNameInAppDataPath conf/ "{workdir}/name" 或 {workdir}/app/name
func FileNameInAppDataPathV2 ¶ added in v1.2.20
FileNameInAppDataPathV2 conf/ "{workdir}/app/name"
func FileNameInConfAppPath ¶ added in v1.8.97
FileNameInConfAppPath conf/appName 不带env "conf/{appName}/name"
func FileNameInConfPath ¶ added in v1.1.6
FileNameInConfPath conf/ "confPath/name"
func FileNameInDataPath ¶ added in v1.6.11
FileNameInDataPath conf/ 目录下 "{DataPath}/name"
func FileNameInEnvDataPath ¶ added in v1.6.11
FileNameInEnvDataPath conf/ 目录下 "{DataPath}/{Env}/name"
func FileNameInEnvPath ¶ added in v1.1.6
FileNameInEnvPath env/{Env}/name
func FileNameWithEnvInConfAppPath ¶ added in v1.1.6
FileNameWithEnvInConfAppPath conf/appName 带env "conf/{appName}/{Env}.name"
func FileNameWithEnvInDataPath ¶ added in v1.6.11
FileNameWithEnvInDataPath conf/ 目录下 "{DataPath}/{Env}.name"
func FileNameWithoutEnvInConfAppPath ¶ added in v1.1.6
FileNameWithoutEnvInConfAppPath Deprecated: this function simply calls FileNameInConfAppPath.
func FileNameWithoutEnvInEnvPath ¶ added in v1.1.6
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 GetEnvPath ¶ added in v1.1.6
func GetEnvPath() string
func GetExecPath ¶ added in v1.3.20
func GetExecPath() string
func IsDefaultDataPath ¶ added in v1.8.83
func IsDefaultDataPath() bool
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 UseAppDataPathV2 ¶ added in v1.1.6
func UseAppDataPathV2()
func UseAppDataVersion ¶ added in v1.8.81
func UseAppDataVersion(ver int)
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"` AppDataVersion int `json:"appDataVersion" yaml:"appDataVersion" xml:"appDataVersion"` 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"` // contains filtered or unexported fields }
type HandlerFunc ¶ added in v1.20.15
type Option ¶ added in v1.8.55
type Option func(c *Config)
func WithAppConfPath ¶ added in v1.8.55
func WithAppDataPath ¶ added in v1.8.55
func WithAppDataPathV2 ¶ added in v1.8.55
func WithDataPath ¶ added in v1.8.81
func WithWorkDir ¶ added in v1.8.55
Click to show internal directories.
Click to hide internal directories.