Added helper to switch environments.
This commit is contained in:
parent
6b537c5626
commit
0a8d08d8bd
2 changed files with 9 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/joeshaw/envdecode"
|
||||
|
|
@ -85,3 +86,9 @@ func GetConfig() (Config, error) {
|
|||
err := envdecode.StrictDecode(&cfg)
|
||||
return cfg, err
|
||||
}
|
||||
|
||||
func SwitchEnv(env Env) {
|
||||
if err := os.Setenv("APP_ENV", string(env)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue