feat: Add Docker Compose configuration for PostgreSQL and update database credentials in main.go

This commit is contained in:
Jean Jacques Avril 2025-03-10 22:25:03 +00:00
parent 8785b86bfc
commit dde2017ad1
2 changed files with 24 additions and 8 deletions

View File

@ -26,12 +26,12 @@ import (
// @x-extension ulid.ULID string // @x-extension ulid.ULID string
// @Summary Say hello // @Summary Say hello
// @Description Get a hello message // @Description Get a hello message
// @ID hello // @ID hello
// @Produce plain // @Produce plain
// @Success 200 {string} string "Hello from the Time Tracker Backend!" // @Success 200 {string} string "Hello from the Time Tracker Backend!"
// @Router / [get] // @Router / [get]
func helloHandler(c *gin.Context) { func helloHandler(c *gin.Context) {
c.String(http.StatusOK, "Hello from the Time Tracker Backend!") c.String(http.StatusOK, "Hello from the Time Tracker Backend!")
} }
@ -41,9 +41,9 @@ func main() {
dbConfig := models.DatabaseConfig{ dbConfig := models.DatabaseConfig{
Host: "localhost", Host: "localhost",
Port: 5432, Port: 5432,
User: "postgres", User: "timetracker",
Password: "password", Password: "password",
DBName: "mydatabase", DBName: "timetracker",
SSLMode: "disable", // For development environment SSLMode: "disable", // For development environment
} }

16
docker-compose.yml Normal file
View File

@ -0,0 +1,16 @@
services:
db:
image: postgres:14
container_name: timetracker_db
restart: always
ports:
- "5432:5432"
environment:
POSTGRES_USER: timetracker
POSTGRES_PASSWORD: password
POSTGRES_DB: timetracker
volumes:
- db_data:/var/lib/postgresql/data
volumes:
db_data: