only load .env file when not in prod
This commit is contained in:
parent
48e6a851fa
commit
0f95094014
1 changed files with 23 additions and 21 deletions
|
|
@ -19,10 +19,12 @@ type TemplateRenderer struct {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Load connection string from .env file
|
// Load connection string from .env file
|
||||||
|
if os.Getenv("GO_ENV") != "production" {
|
||||||
err := godotenv.Load()
|
err := godotenv.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("failed to load env", err)
|
log.Fatal("failed to load env", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
templates, err := template.New("").ParseGlob("public/views/*.html")
|
templates, err := template.New("").ParseGlob("public/views/*.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue