Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

appenv

GoDoc

appenv is simple golang application runtime envrionment library.

Requirement

Go 1.15

Installing

go get github.com/hlts2/appenv

Possible environment

  • test
  • development
  • staging
  • production
  • unknown

Example

package main

import (
	"fmt"
	"os"

	"github.com/hlts2/appenv"
)

func init() {
	os.Setenv("APP_ENV", "production")
}

func main() {
	env := appenv.Env("APP_ENV")

	switch env {
	case appenv.Test:
		fmt.Println(env.String()) // test
	case appenv.Dev:
		fmt.Println(env.String()) // development
	case appenv.Stg:
		fmt.Println(env.String()) // staging
	case appenv.Prod:
		fmt.Println(env.String()) // production
	default:
		fmt.Println(env.String()) // unknown
	}
}

About

Application runtime environment

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages