Documentation
¶
Index ¶
- func AppEnvironment() string
- func Get(key string) string
- func GetDefault(key, defaultValue string) string
- func GoVersion() string
- func IsDevelopment() bool
- func IsProduction() bool
- func Parse(v any) error
- func Revision() string
- func RevisionModified() bool
- func RevisionShort() string
- func RevisionTime() time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppEnvironment ¶
func AppEnvironment() string
AppEnvironment returns the name of the current environment the app is in
func GetDefault ¶
GetDefault returns the value of the specified environment variable If the variable is not defined or is empty, return the default value
func GoVersion ¶ added in v1.2.0
func GoVersion() string
GoVersion returns the Go version used to build the application
func IsDevelopment ¶
func IsDevelopment() bool
IsDevelopment returns true if the current environment is development
func IsProduction ¶
func IsProduction() bool
IsProduction returns if the current environment is production
func Parse ¶ added in v1.2.0
Parse parses environment variables into the provided struct. See github.com/caarlos0/env for tag documentation.
Additionally supports buildinfo tags for build information:
type Config struct {
GoVersion string `buildinfo:"goversion"`
Revision string `buildinfo:"revision"`
Short string `buildinfo:"revisionshort"`
Time time.Time `buildinfo:"revisiontime"`
Modified bool `buildinfo:"revisionmodified"`
}
func Revision ¶ added in v1.2.0
func Revision() string
Revision returns the full VCS revision used to build the application
func RevisionModified ¶ added in v1.2.0
func RevisionModified() bool
RevisionModified returns true if there were uncommitted changes when the application was built
func RevisionShort ¶ added in v1.2.0
func RevisionShort() string
RevisionShort returns the short VCS revision used to build the application
func RevisionTime ¶ added in v1.2.0
RevisionTime returns the VCS revision time used to build the application
Types ¶
This section is empty.