Skip to content

Commit

Permalink
create flexible config for hosts using DATABASE_URL and DATABASE_HOST
Browse files Browse the repository at this point in the history
  • Loading branch information
donrestarone committed Nov 30, 2024
1 parent 41e97d8 commit 143ebf1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/website.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<%= render partial: 'shared/flash' %>
<%= render partial: 'shared/navbars/web_admin' %>

<%= "postgres://#{ENV['DATABASE_USERNAME']}:#{ENV['DATABASE_PASSWORD']}@#{ENV['DATABASE_HOST']}:#{ENV['DATABASE_PORT']}/#{ENV['DATABASE_NAME']}" %>
<%= ENV['DATABASE_HOST'] ? "postgres://#{ENV['DATABASE_USERNAME']}:#{ENV['DATABASE_PASSWORD']}@#{ENV['DATABASE_HOST']}:#{ENV['DATABASE_PORT']}/#{ENV['DATABASE_NAME']}" : ENV['DATABASE_URL'] %>
<body data-page-id="<%= @cms_page&.id %>">
<%= yield %>
<%= render_cookies_consent_ui %>
Expand Down
2 changes: 1 addition & 1 deletion config/blazer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

data_sources:
main:
url: <%= "postgres://#{ENV['DATABASE_USERNAME']}:#{ENV['DATABASE_PASSWORD']}@#{ENV['DATABASE_HOST']}:#{ENV['DATABASE_PORT']}/#{ENV['DATABASE_NAME']}" %>
url: <%= ENV['DATABASE_HOST'] ? "postgres://#{ENV['DATABASE_USERNAME']}:#{ENV['DATABASE_PASSWORD']}@#{ENV['DATABASE_HOST']}:#{ENV['DATABASE_PORT']}/#{ENV['DATABASE_NAME']}" : ENV['DATABASE_URL'] %>
# statement timeout, in seconds
# none by default
# timeout: 15
Expand Down

0 comments on commit 143ebf1

Please sign in to comment.