Compare commits
No commits in common. "4ec50cee8a6d1c65483710a2e559056fe2d3bb9e" and "5fb0764630adad749bd8353ce56668ec7357144d" have entirely different histories.
4ec50cee8a
...
5fb0764630
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
|
||||||
|
|
||||||
"legalgo-BE-go/config"
|
"legalgo-BE-go/config"
|
||||||
"legalgo-BE-go/database"
|
"legalgo-BE-go/database"
|
||||||
@ -13,14 +12,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Check if the .env file exists
|
|
||||||
if _, err := os.Stat(".env"); err == nil {
|
|
||||||
// Load environment variables from .env file if it exists
|
|
||||||
if err := godotenv.Load(); err != nil {
|
if err := godotenv.Load(); err != nil {
|
||||||
log.Println("Error loading .env file, continuing without it")
|
log.Fatal("cannot load environment file")
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Println(".env file not found, skipping load")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.InitEnv()
|
config.InitEnv()
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
|
||||||
|
|
||||||
"legalgo-BE-go/config"
|
"legalgo-BE-go/config"
|
||||||
"legalgo-BE-go/database"
|
"legalgo-BE-go/database"
|
||||||
@ -19,14 +18,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Check if the .env file exists
|
|
||||||
if _, err := os.Stat(".env"); err == nil {
|
|
||||||
// Load environment variables from .env file if it exists
|
|
||||||
if err := godotenv.Load(); err != nil {
|
if err := godotenv.Load(); err != nil {
|
||||||
log.Println("Error loading .env file, continuing without it")
|
log.Fatal("cannot load environment file")
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Println(".env file not found, skipping load")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.InitEnv()
|
config.InitEnv()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user