go-skeletor/vendor/github.com/go-martini/martini/env.go

32 lines
463 B
Go
Raw Normal View History

2021-11-02 11:25:21 +01:00
package martini
import (
"os"
)
// Envs
const (
Dev string = "development"
Prod string = "production"
Test string = "test"
)
// Env is the environment that Martini is executing in. The MARTINI_ENV is read on initialization to set this variable.
var Env = Dev
var Root string
func setENV(e string) {
if len(e) > 0 {
Env = e
}
}
func init() {
setENV(os.Getenv("MARTINI_ENV"))
var err error
Root, err = os.Getwd()
if err != nil {
panic(err)
}
}