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