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-01-18 15:55:32 +01:00

45 lines
872 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")
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{"172.19.0.2"},
}
app.start()
//r := gin.Default()
}
/*func terminateWithError(statusCode int, message string, c *gin.Context) {
c.JSON(statusCode, gin.H{"error": message})
c.Abort()
}
*/