32 lines
463 B
Go
32 lines
463 B
Go
|
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)
|
||
|
}
|
||
|
}
|