diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cd9b5afe..56ca1e0f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,11 +22,16 @@ // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": ".devcontainer/post-create.sh", - // HACK: Out of the box, this dev container doesn't allow installation to the - // default GEM_HOME, because of a weird thing going on with RVM. Instead, we - // set a custom GEM_HOME and GEM_PATH in our home directory! - // https://github.com/devcontainers/templates/issues/188 "containerEnv": { + // Because the database is hosted on the local network at the hostname `db`, + // we partially override `config/database.yml` to connect to `db`! + "DATABASE_URL_PRIMARY_DEV": "mysql2://db", + "DATABASE_URL_OPENNEO_ID_DEV": "mysql2://db", + + // HACK: Out of the box, this dev container doesn't allow installation to + // the default GEM_HOME, because of a weird thing going on with RVM. + // Instead, we set a custom GEM_HOME and GEM_PATH in our home directory! + // https://github.com/devcontainers/templates/issues/188 "GEM_HOME": "~/.rubygems", "GEM_PATH": "~/.rubygems" } diff --git a/config/database.yml b/config/database.yml index 2fbc7152..81a389e9 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,7 +1,9 @@ development: primary: + # You can override these default settings with this environment variable, + # fully or partially. We do this in the .devcontainer setup! + url: <%= ENV['DATABASE_URL_PRIMARY_DEV'] %> adapter: mysql2 - host: db database: openneo_impress username: impress_dev password: impress_dev @@ -10,8 +12,10 @@ development: sql_mode: TRADITIONAL openneo_id: + # You can override these default settings with this environment variable, + # fully or partially. We do this in the .devcontainer setup! + url: <%= ENV['DATABASE_URL_OPENNEO_ID_DEV'] %> adapter: mysql2 - host: db database: openneo_id username: impress_dev password: impress_dev