Skip to content

Commit 954a3be

Browse files
authored
Merge pull request rails#54694 from yahonda/set_mysql_codebases_environment_variable
Enable `MYSQL_CODESPACES` environment variable in the devcontainer
2 parents 276b5e9 + cc5b688 commit 954a3be

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.devcontainer/boot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ cd activerecord || { echo "activerecord directory doesn't exist"; exit; }
1414
bundle exec rake db:postgresql:rebuild
1515

1616
# Create MySQL databases
17-
MYSQL_CODESPACES=1 bundle exec rake db:mysql:rebuild
17+
bundle exec rake db:mysql:rebuild

.devcontainer/compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ services:
1616
- redis
1717
- memcached
1818

19+
environment:
20+
MYSQL_CODESPACES: "1"
21+
1922
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
2023
# (Adding the "ports" property to this file will not forward from a Codespace.)
2124

railties/test/isolation/abstract_unit.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ def use_mysql2(multi_db: false)
539539
adapter: mysql2
540540
pool: 5
541541
username: root
542+
<% if ENV['MYSQL_CODESPACES'] %>
543+
password: 'root'
544+
<% end %>
542545
<% if ENV['MYSQL_HOST'] %>
543546
host: <%= ENV['MYSQL_HOST'] %>
544547
<% end %>
@@ -562,6 +565,9 @@ def use_mysql2(multi_db: false)
562565
adapter: mysql2
563566
pool: 5
564567
username: root
568+
<% if ENV['MYSQL_CODESPACES'] %>
569+
password: 'root'
570+
<% end %>
565571
<% if ENV['MYSQL_HOST'] %>
566572
host: <%= ENV['MYSQL_HOST'] %>
567573
<% end %>

0 commit comments

Comments
 (0)