feat: Add Docker Compose configuration for PostgreSQL and update database credentials in main.go
This commit is contained in:
parent
8785b86bfc
commit
dde2017ad1
@ -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
16
docker-compose.yml
Normal 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:
|
Loading…
x
Reference in New Issue
Block a user