Documentation ¶
Overview ¶
Package env standardizes environment names for use in environment based switching and implements both a flag and an environment variable for managing what environment the binary should currently be operating under.
Although both flag and envflag may be imported at the same time for different uses (e.g. flag for '-v' and '-h', envflag for 'ENV=production', only one or the other should be used to declare the environment; never both at the same time.
In addition, this package is able to detect whether or not a given program is being run under a continuous integration system, such as Drone, Jenkins, etc.
Index ¶
Constants ¶
const ( Production = "production" Development = "development" Staging = "staging" )
Production, Development, Staging, and Testing are the runtime environments which are recognized by the env package.
Variables ¶
var ( // Env is the current environment specified by flag or envflag. // TODO: should have an Unknown env state, since the Env variable is not // guaranteed to be set properly if used directly (not through access functions). Env string )
Functions ¶
func IsCI ¶
func IsCI() bool
IsCI returns boolean true if the program is being run under a continuous integration environment, and false otherwise.
func IsDevelopment ¶
func IsDevelopment() bool
IsDevelopment returns boolean true if the current environment is "development", and false otherwise.
func IsProduction ¶
func IsProduction() bool
IsProduction returns boolean true if the current environment is "production", and false otherwise.
func IsProductionLike ¶
func IsProductionLike() bool
IsProductionLike returns boolean true if the environment is an actual prod-like environment
Types ¶
This section is empty.