Documentation ¶
Index ¶
Constants ¶
View Source
const ( //环境变量中配置文件路径 ApplicationEnvVar = "TRAN_TICKET_APP" // api.yml文件路径在环境中的变量名 ApiEnvVar = "TRAN_TICKET_API" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type ApiConfig ¶
type ApplicationConfig ¶
type ApplicationConfig struct { Environment string EnvironmentConfig // contains filtered or unexported fields }
func NewApplicationConfig ¶
func NewApplicationConfig() *ApplicationConfig
func (*ApplicationConfig) Is ¶
func (c *ApplicationConfig) Is(env string) bool
func (*ApplicationConfig) IsDev ¶
func (c *ApplicationConfig) IsDev() bool
func (*ApplicationConfig) IsProd ¶
func (c *ApplicationConfig) IsProd() bool
func (*ApplicationConfig) IsTest ¶
func (c *ApplicationConfig) IsTest() bool
func (*ApplicationConfig) Load ¶
func (c *ApplicationConfig) Load() error
Load 加载配置文件,先尝试从环境变量中的配置文件位置中读取,再尝试从程序所在位置下的config目录中读取
type ConfigContent ¶
type ConfigContent struct { Environment string `json:"environment" yaml:"environment"` Configurations []EnvironmentConfig `json:"configurations" yaml:"configurations"` }
type EnvironmentConfig ¶
Click to show internal directories.
Click to hide internal directories.