env

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

配置模块

该包用于接管全局公共配置类的一些相关操作,统一管理

环境变量

export GO_ENV=dev

示例

  • 获取当前环境的运行模式:env.GetMode()
  • 判断是否为开发模式:env.IsDevMode()
  • 判断是否为测试模式:env.IsTestMode()
  • 判断是否预发布模式:env.IsReleaseMode()
  • 判断是否生产环境:env.IsProdMode()

Documentation

Index

Constants

View Source
const (
	EnvName     = "GO_ENV"  //标识名
	DevMode     = "dev"     //开发环境
	TestMode    = "test"    //测试环境
	ReleaseMode = "release" //预发布环境
	ProdMode    = "prod"    //生产环境
)

Variables

This section is empty.

Functions

func GetMode

func GetMode() (env string, err error)

获取当前环境的运行模式

func IsDevMode

func IsDevMode() bool

判断是否为开发模式

func IsProdMode

func IsProdMode() bool

判断是否生产环境

func IsReleaseMode

func IsReleaseMode() bool

判断是否预发布模式

func IsTestMode

func IsTestMode() bool

判断是否测试模式

Types

This section is empty.

Jump to

Keyboard shortcuts

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