From b257de85f244aefaf47af5ffaffdba9771b361b1 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 11 Nov 2025 12:20:25 -0800 Subject: [PATCH] Allow more flexible development DB config --- .devcontainer/compose.yaml | 13 ++++++++----- config/database.yml | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index d13bc430..b1da2f12 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -7,7 +7,7 @@ services: dockerfile: .devcontainer/Dockerfile volumes: - - ../..:/workspaces:cached + - ../..:/workspaces:cached # Overrides default command so things don't shut down after the process ends. command: sleep infinity @@ -18,17 +18,20 @@ services: # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. # (Adding the "ports" property to this file will not forward from a Codespace.) depends_on: - - mysql + - mysql + + environment: + DB_USER: root mysql: image: mariadb:10.6 restart: unless-stopped environment: - MYSQL_ALLOW_EMPTY_PASSWORD: 'true' + MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 'true' volumes: - - mysql-data:/var/lib/mysql + - mysql-data:/var/lib/mysql networks: - - default + - default volumes: mysql-data: diff --git a/config/database.yml b/config/database.yml index 52792505..09049098 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,7 +3,7 @@ development: adapter: mysql2 host: <%= ENV.fetch("DB_HOST", "localhost") %> database: openneo_impress - username: root + username: <%= ENV.fetch("DB_USER", ENV.fetch("USER", "root")) %> pool: 5 encoding: utf8mb4 collation: utf8mb4_unicode_520_ci @@ -14,7 +14,7 @@ development: adapter: mysql2 host: <%= ENV.fetch("DB_HOST", "localhost") %> database: openneo_id - username: root + username: <%= ENV.fetch("DB_USER", ENV.fetch("USER", "root")) %> pool: 2 variables: sql_mode: TRADITIONAL @@ -25,7 +25,7 @@ test: adapter: mysql2 host: <%= ENV.fetch("DB_HOST", "localhost") %> database: openneo_impress_test - username: root + username: <%= ENV.fetch("DB_USER", ENV.fetch("USER", "root")) %> pool: 5 encoding: utf8mb4 collation: utf8mb4_unicode_520_ci @@ -36,7 +36,7 @@ test: adapter: mysql2 host: <%= ENV.fetch("DB_HOST", "localhost") %> database: openneo_id_test - username: root + username: <%= ENV.fetch("DB_USER", ENV.fetch("USER", "root")) %> pool: 2 variables: sql_mode: TRADITIONAL