Skip to content

Commit b0e58a9

Browse files
committed
Enable more than one host for configuration
1 parent 128f11c commit b0e58a9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/app.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PidApp < Sinatra::Base
4242
username: DATABASE_CONFIG['db_username'],
4343
password: DATABASE_CONFIG['db_password']
4444
}
45-
45+
4646
TEST_MODE = false
4747

4848
# If we're in test mode switch to SQLite and a temp Redis secret
@@ -66,8 +66,9 @@ class PidApp < Sinatra::Base
6666
end
6767

6868
configure :development, :production do
69+
PERMITTED_HOSTNAMES = [APP_CONFIG['app_host']] + (APP_CONFIG['alt_app_hosts'] || "").split(',').map(&:strip)
6970
enable :logging
70-
set :host_authorization, { permitted_hosts: [APP_CONFIG['app_host']] }
71+
set :host_authorization, { permitted_hosts: PERMITTED_HOSTNAMES }
7172
end
7273

7374
set :session_secret, SECURITY_CONFIG['session_secret']

app/config/app.yml.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ application_name: 'PID Service'
55
# The server and port where the main PID application will be hosted (comment out the port if you do not need to specify)
66
app_host: <%= ENV['APP_HOST'] %>
77
app_port: <%= ENV['APP_PORT'] %>
8+
alt_app_hosts: <%= ENV['ALT_APP_HOSTS'] %>
89

910
# The url that the system should direct users to when an inactive PID is requested
1011
dead_pid_url: <%= ENV['DEAD_PID_URL'] %>

0 commit comments

Comments
 (0)