config

package
v1.2.27 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Zlib Imports: 4 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 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 FileNameInEnvPath added in v1.1.6

func FileNameInEnvPath(name string) string

FileNameInEnvPath 在 env/ 目录下,配合环境

func FileNameWithEnvInConfAppPath added in v1.1.6

func FileNameWithEnvInConfAppPath(name string) string

FileNameWithEnvInConfAppPath 在 conf/appName 目录下带env "confAppPath/env.name"

func FileNameWithoutEnvInConfAppPath added in v1.1.6

func FileNameWithoutEnvInConfAppPath(name string) string

FileNameWithoutEnvInConfAppPath 在 conf/appName 目录不带env "confAppPath/name"

func FileNameWithoutEnvInEnvPath added in v1.1.6

func FileNameWithoutEnvInEnvPath(name string) string

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 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 UseDataV2 added in v1.2.20

func UseDataV2(ver int)

Types

type Config

type Config struct {
	LogConfig     logger.Config `json:"log" yaml:"log" xml:"log"`
	Mode          string        `json:"mode" yaml:"mode" xml:"mode"`
	Server        string        `json:"server" yaml:"server" xml:"server"`
	PubIP         string        `json:"publicIp" yaml:"publicIp" xml:"publicIp"`
	AppDataPathV2 bool          `json:"appDataPathV2" yaml:"appDataPathV2" xml:"appDataPathV2"`
	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 (cfg *Config) Init()

Jump to

Keyboard shortcuts

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