more boilerplate and dev environment

This commit is contained in:
2026-07-16 16:04:48 -07:00
parent ea34be4e1b
commit a06f21a5c2
27 changed files with 670 additions and 27 deletions
+8 -2
View File
@@ -20,8 +20,14 @@ func InitDB() (*sql.DB, error) {
password = "secret"
}
// Build the DSN. The host "db" matches the service name in docker-compose.yml.
dsn := fmt.Sprintf("oworganizer:%s@tcp(db:3306)/?parseTime=true", password)
host := os.Getenv("DB_HOST")
if host == "" {
// Default to the Docker Compose service name.
host = "db"
}
// Build the DSN. The default host "db" matches the service name in docker-compose.yml.
dsn := fmt.Sprintf("oworganizer:%s@tcp(%s:3306)/?parseTime=true", password, host)
db, err := sql.Open("mysql", dsn)
if err != nil {