31 lines
619 B
Go
31 lines
619 B
Go
package services
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"strconv"
|
|
|
|
"git.jamestombleson.com/jtom38/go-cook/internal/domain"
|
|
|
|
"github.com/joho/godotenv"
|
|
)
|
|
|
|
func NewEnvConfig() domain.EnvConfig {
|
|
err := godotenv.Load()
|
|
if err != nil {
|
|
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"),
|
|
ApiUri: os.Getenv("ApiUri"),
|
|
DisableMigrationsOnStartUp: disableMigrations,
|
|
}
|
|
}
|