mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 14:22:33 +03:00
feat: add env autoload
This commit is contained in:
parent
843e81dd78
commit
fe4d2a0501
@ -39,7 +39,7 @@ func getAppConfig() AppConfig {
|
||||
func getDbConfig() DbConfig {
|
||||
url := os.Getenv("POSTGRES_URL")
|
||||
if url == "" {
|
||||
url = "postgresql://localhost/dumpach"
|
||||
url = "postgresql://localhost/micrach"
|
||||
}
|
||||
return DbConfig{
|
||||
Url: url,
|
||||
|
11
main.go
11
main.go
@ -5,7 +5,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/joho/godotenv"
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
|
||||
Config "micrach/config"
|
||||
// Controllers "micrach/controllers"
|
||||
@ -14,18 +14,9 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
err := godotenv.Load(".env")
|
||||
if err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
|
||||
Config.Init()
|
||||
Db.Init()
|
||||
defer Db.Pool.Close()
|
||||
// err = Utils.CreateUploadsFolder()
|
||||
if err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
gin.SetMode(Config.App.Env)
|
||||
|
||||
router := gin.Default()
|
||||
|
Loading…
Reference in New Issue
Block a user