fix: remove db utils
This commit was merged in pull request #294.
This commit is contained in:
7
main.go
7
main.go
@@ -7,7 +7,6 @@ import (
|
||||
"me-fit/middleware"
|
||||
"me-fit/service"
|
||||
"me-fit/types"
|
||||
"me-fit/utils"
|
||||
|
||||
"context"
|
||||
"database/sql"
|
||||
@@ -38,7 +37,7 @@ func main() {
|
||||
run(context.Background(), db, os.Getenv)
|
||||
}
|
||||
|
||||
func run(ctx context.Context, db *sql.DB, env func(string) string) {
|
||||
func run(ctx context.Context, database *sql.DB, env func(string) string) {
|
||||
ctx, cancel := signal.NotifyContext(ctx, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
|
||||
@@ -48,7 +47,7 @@ func run(ctx context.Context, db *sql.DB, env func(string) string) {
|
||||
serverSettings := types.NewServerSettingsFromEnv(env)
|
||||
|
||||
// init db
|
||||
err := utils.RunMigrations(db, "")
|
||||
err := db.RunMigrations(database, "")
|
||||
if err != nil {
|
||||
log.Error("Could not run migrations: %v", err)
|
||||
os.Exit(1)
|
||||
@@ -66,7 +65,7 @@ func run(ctx context.Context, db *sql.DB, env func(string) string) {
|
||||
|
||||
httpServer := &http.Server{
|
||||
Addr: ":" + serverSettings.Port,
|
||||
Handler: createHandler(db, serverSettings),
|
||||
Handler: createHandler(database, serverSettings),
|
||||
}
|
||||
go startServer(httpServer)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user