the env will now let you define if the migrations should run on startup
This commit is contained in:
parent
0c7c4d311e
commit
d2aa1b99ce
@ -3,4 +3,5 @@ package domain
|
||||
type EnvConfig struct {
|
||||
AdminToken string
|
||||
JwtSecret string
|
||||
DisableMigrationsOnStartUp bool
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"go-cook/api/domain"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"git.jamestombleson.com/jtom38/go-cook/api/domain"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
@ -14,8 +16,14 @@ func NewEnvConfig() domain.EnvConfig {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
disableMigrations, err := strconv.ParseBool(os.Getenv("DisableMigrationsOnStartup"))
|
||||
if err != nil {
|
||||
disableMigrations = false
|
||||
}
|
||||
|
||||
return domain.EnvConfig{
|
||||
AdminToken: os.Getenv("AdminToken"),
|
||||
JwtSecret: os.Getenv("JwtSecret"),
|
||||
DisableMigrationsOnStartUp: disableMigrations,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user