Skip to content

Commit

Permalink
Print DB Config for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
rickychilcott committed Jul 19, 2024
1 parent 04245b1 commit 6cca3af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
DB: "${{ matrix.db }}"
DB_USERNAME: thredded
DB_PASSWORD: thredded
DB_POOL: 1
steps:
- uses: actions/checkout@v4

Expand Down
6 changes: 4 additions & 2 deletions spec/dummy/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ db_host = ENV.fetch('DB_HOST', ENV.fetch('DB_1_PORT_5432_TCP_ADDR', 'localhos
db_port = ENV['DB_1_PORT_5432_TCP_PORT'] || ENV['DB_PORT'] ||
{'postgresql' => 5432, 'mysql2' => 3306}[db_adapter]
require 'etc'
pool_size = ENV['DB_POOL'] || (
db_pool_size = ENV['DB_POOL'] || (
# Web: max workers * max threads
ENV.fetch('WEB_CONCURRENCY', 3).to_i * ENV.fetch('MAX_THREADS', 5).to_i +
# ActiveJob Async max thread pool size
Etc.nprocessors
)
puts "DATABASE CONFIGURATION", db_adapter, db_host, db_port, db_pool_size
%>

defaults: &defaults
host: <%= db_host %>
port: <%= db_port %>
adapter: <%= db_adapter %>
min_messages: WARNING
pool: <%= pool_size %>
pool: <%= db_pool_size %>
username: <%= ENV.fetch('DB_USERNAME', 'thredded').inspect %>
password: <%= ENV.fetch('DB_PASSWORD', 'thredded').inspect %>
encoding: <%= db_adapter == 'mysql2' ? "utf8mb4\n charset: utf8mb4\n collation: utf8mb4_unicode_ci" : 'utf8' %>
Expand Down

0 comments on commit 6cca3af

Please sign in to comment.