Update to use MySQL Database

This commit is contained in:
2026-03-05 14:24:04 -04:00
parent 9ecf919d68
commit 25fd4a8be7
6 changed files with 104 additions and 66 deletions

View File

@@ -11,7 +11,14 @@ import (
)
func main() {
dsn := getenv("DATABASE_DSN", "walkies.db")
// Build MySQL DSN from environment variables
dbHost := getenv("DB_HOST", "localhost")
dbPort := getenv("DB_PORT", "3306")
dbUser := getenv("DB_USER", "root")
dbPassword := getenv("DB_PASSWORD", "")
dbName := getenv("DB_NAME", "walkies")
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?parseTime=true", dbUser, dbPassword, dbHost, dbPort, dbName)
jwtSecret := getenv("JWT_SECRET", "change-me-in-production")
staticDir := getenv("STATIC_DIR", "./web/dist")
port := getenv("PORT", "8080")