🚧 A bit of initial work
This commit is contained in:
parent
84945e0f54
commit
2b888f203d
7 changed files with 326 additions and 1 deletions
37
config/env.go
Normal file
37
config/env.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package config
|
||||
|
||||
type Env string
|
||||
|
||||
const (
|
||||
DEV Env = "dev"
|
||||
PROD Env = "prod"
|
||||
QA Env = "qa"
|
||||
TEST Env = "test"
|
||||
)
|
||||
|
||||
var Envs = [...]Env{
|
||||
DEV,
|
||||
PROD,
|
||||
QA,
|
||||
TEST,
|
||||
}
|
||||
|
||||
func ValidEnvOrDev(e Env) Env {
|
||||
if ValidEnv(e) {
|
||||
return e
|
||||
}
|
||||
return DEV
|
||||
}
|
||||
|
||||
func ValidEnv(env Env) bool {
|
||||
for _, e := range Envs {
|
||||
if env == e {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (e Env) String() string {
|
||||
return string(e)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue