diff --git a/database/init.go b/database/init.go index 30425bd..a57d2b3 100644 --- a/database/init.go +++ b/database/init.go @@ -18,9 +18,9 @@ func DBConnect() (*sql.DB, error) { dbPassword := os.Getenv("DB_PASSWORD") dbName := os.Getenv("DB_NAME") dbPort := os.Getenv("DB_PORT") - dbHost := "127.0.0.1" + dbHost := os.Getenv("DB_HOST") dbConn := fmt.Sprintf( - "%s:%s@tcp(%s:%s)/%s?parseTime=true", + "%s:%s@tcp(%s:%s)/%s?parseTime=true&tls=true&interpolateParams=true", dbUser, dbPassword, dbHost, diff --git a/database/init_gorm.go b/database/init_gorm.go index ea01836..2077485 100644 --- a/database/init_gorm.go +++ b/database/init_gorm.go @@ -19,14 +19,16 @@ func DBConnectGorm() (db *gorm.DB, err error) { dbPassword := os.Getenv("DB_PASSWORD") dbName := os.Getenv("DB_NAME") dbPort := os.Getenv("DB_PORT") - dbHost := "127.0.0.1" + dbHost := os.Getenv("DB_HOST") + dbTls := os.Getenv("DB_TLS") dbConn := fmt.Sprintf( - "%s:%s@tcp(%s:%s)/%s?parseTime=true", + "%s:%s@tcp(%s:%s)/%s?parseTime=true&tls=%s&interpolateParams=true", dbUser, dbPassword, dbHost, dbPort, dbName, + dbTls, ) db, err = gorm.Open(mysql.Open(dbConn), &gorm.Config{}) diff --git a/main.go b/main.go index 702c1c7..099664e 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ type TestResponse struct { func (s Server) GetApiEvent(ctx echo.Context, params openapi.GetApiEventParams) error { return ctx.JSON(http.StatusOK, TestResponse{ - Message: "search events", + Message: "get events", }) }