This repository has been archived on 2025-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Hochzeit/main.go
2022-02-03 13:56:56 +01:00

39 lines
740 B
Go

package main
import (
"fmt"
"os"
"github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
"github.com/joho/godotenv"
"github.com/labstack/gommon/log"
)
func main() {
err := godotenv.Load(".env")
if err != nil {
log.Fatalf("ENV file not found")
}
dbhost := os.Getenv("DB_HOST")
dbuser := os.Getenv("DB_USER")
dbpass := os.Getenv("DB_PASS")
dbdata := os.Getenv("DB_DATA")
proxyip := os.Getenv("PROXYIP")
connectionstring := fmt.Sprintf("host=%s user=%s password=%s dbname=%s sslmode=disable", dbhost, dbuser, dbpass, dbdata)
db, err := gorm.Open("postgres", connectionstring)
if err != nil {
panic(err.Error())
}
app := App{
db: db,
r: gin.Default(),
proxyips: []string{proxyip},
}
app.start()
}