Skip to content

Commit f20c8d1

Browse files
committed
Add staging environment configuration
1 parent b655a01 commit f20c8d1

File tree

8 files changed

+41
-4
lines changed

8 files changed

+41
-4
lines changed

config/cable.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ development:
44
test:
55
adapter: async
66

7-
production:
7+
production: &redis_cable
88
adapter: redis
99
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
1010
channel_prefix: standalone-pwb_production
11+
12+
staging:
13+
<<: *redis_cable
14+
channel_prefix: standalone-pwb_staging

config/database.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,10 @@ production:
9191
username: pwb
9292
password: <%= ENV['PWB_DATABASE_PASSWORD'] %>
9393
prepared_statements: false
94+
95+
staging:
96+
<<: *default
97+
database: pwb_staging
98+
username: pwb
99+
password: <%= ENV['PWB_STAGING_DATABASE_PASSWORD'] || ENV['PWB_DATABASE_PASSWORD'] %>
100+
prepared_statements: false

config/environments/staging.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require_relative "production"
2+
3+
Rails.application.configure do
4+
# Use a dedicated host for staging emails and generated links.
5+
config.action_mailer.default_url_options = {
6+
host: ENV.fetch("MAILER_HOST") do
7+
ENV.fetch("STAGING_APP_HOST") { ENV.fetch("APP_HOST", "staging.example.com") }
8+
end,
9+
protocol: ENV.fetch("STAGING_APP_PROTOCOL", "https")
10+
}
11+
end

config/queue.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ test:
1616

1717
production:
1818
<<: *default
19+
20+
staging:
21+
<<: *default

config/recurring.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# priority: 2
1010
# schedule: at 5am every day
1111

12-
production:
12+
production: &production
1313
clear_solid_queue_finished_jobs:
1414
command: "SolidQueue::Job.clear_finished_in_batches(sleep_between_batches: 0.3)"
1515
schedule: every hour at minute 12
@@ -31,3 +31,6 @@ production:
3131
queue: default
3232
description: "Expire ended trials and subscriptions, send warning notifications"
3333
schedule: every hour at minute 30
34+
35+
staging:
36+
<<: *production

config/seed_images.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,8 @@ test:
106106
e2e:
107107
<<: *default
108108

109+
staging:
110+
<<: *default
111+
109112
production:
110113
<<: *default

config/solid_queue.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ development:
1616
test:
1717
<<: *default
1818

19-
production:
19+
production: &production
2020
dispatchers:
2121
- polling_interval: 1
2222
batch_size: 500
@@ -38,3 +38,6 @@ production:
3838
- queues: [low]
3939
threads: 1
4040
polling_interval: 2
41+
42+
staging:
43+
<<: *production

config/webpacker.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ test:
8383
# Compile test packs to a separate directory
8484
public_output_path: packs-test
8585

86-
production:
86+
production: &production
8787
<<: *default
8888

8989
# Production depends on precompilation of packs prior to booting for performance.
@@ -94,3 +94,6 @@ production:
9494

9595
# Cache manifest.json for performance
9696
cache_manifest: true
97+
98+
staging:
99+
<<: *production

0 commit comments

Comments
 (0)