Make use of ENV.fetch
This commit is contained in:
parent
200d188af2
commit
36b23ce25d
27 changed files with 51 additions and 53 deletions
|
|
@ -1,19 +1,19 @@
|
|||
<%
|
||||
encoding = 'unicode'
|
||||
if ENV['OSEM_DB_ADAPTER'] == 'mysql2'
|
||||
if ENV.fetch('OSEM_DB_ADAPTER', nil) == 'mysql2'
|
||||
encoding = 'utf8'
|
||||
end
|
||||
%>
|
||||
|
||||
|
||||
default: &default
|
||||
adapter: <%= ENV['OSEM_DB_ADAPTER'] || 'postgresql' %>
|
||||
adapter: <%= ENV.fetch('OSEM_DB_ADAPTER', 'postgresql') %>
|
||||
encoding: <%= encoding %>
|
||||
host: <%= ENV['OSEM_DB_HOST'] || 'database' %>
|
||||
port: <%= ENV['OSEM_DB_PORT'] || '5432' %>
|
||||
username: <%= ENV['OSEM_DB_USER'] || 'postgres' %>
|
||||
password: <%= ENV['OSEM_DB_PASSWORD'] || 'mysecretpassword' %>
|
||||
database: <%= ENV['OSEM_DB_NAME'] || 'postgres' %>
|
||||
host: <%= ENV.fetch('OSEM_DB_HOST', 'database') %>
|
||||
port: <%= ENV.fetch('OSEM_DB_PORT', '5432') %>
|
||||
username: <%= ENV.fetch('OSEM_DB_USER', 'postgres') %>
|
||||
password: <%= ENV.fetch('OSEM_DB_PASSWORD', 'mysecretpassword') %>
|
||||
database: <%= ENV.fetch('OSEM_DB_NAME', 'postgres') %>
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ Rails.application.configure do
|
|||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# Set the detault url for action mailer
|
||||
config.action_mailer.default_url_options = { host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000') }
|
||||
config.action_mailer.default_url_options = { host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000') }
|
||||
|
||||
# Access all mails sent at http://localhost:3000/letter_opener
|
||||
config.action_mailer.delivery_method = :letter_opener
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ Devise.setup do |config|
|
|||
# Pass each provider to User model in :omniauth_providers (for open_id providers use their name)
|
||||
|
||||
config.omniauth :open_id, name: 'suse', identifier: 'http://www.opensuse.org/openid/user'
|
||||
config.omniauth :google_oauth2, (ENV['OSEM_GOOGLE_KEY'] || Rails.application.secrets.google_key), (ENV['OSEM_GOOGLE_SECRET'] || Rails.application.secrets.google_secret),
|
||||
config.omniauth :google_oauth2, ENV.fetch('OSEM_GOOGLE_KEY', Rails.application.secrets.google_key), ENV.fetch('OSEM_GOOGLE_SECRET', Rails.application.secrets.google_secret),
|
||||
name: 'google',
|
||||
scope: 'email'
|
||||
config.omniauth :facebook, (ENV['OSEM_FACEBOOK_KEY'] || Rails.application.secrets.facebook_key), (ENV['OSEM_FACEBOOK_SECRET'] || Rails.application.secrets.facebook_secret)
|
||||
config.omniauth :github, (ENV['OSEM_GITHUB_KEY'] || Rails.application.secrets.github_key), (ENV['OSEM_GITHUB_SECRET'] || Rails.application.secrets.github_secret)
|
||||
config.omniauth :facebook, ENV.fetch('OSEM_FACEBOOK_KEY', Rails.application.secrets.facebook_key), ENV.fetch('OSEM_FACEBOOK_SECRET', Rails.application.secrets.facebook_secret)
|
||||
config.omniauth :github, ENV.fetch('OSEM_GITHUB_KEY', Rails.application.secrets.github_key), ENV.fetch('OSEM_GITHUB_SECRET', Rails.application.secrets.github_secret)
|
||||
|
||||
# ==> Mailer Configuration
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
||||
config.mailer_sender = ENV['OSEM_EMAIL_ADDRESS'] || 'no-reply@localhost'
|
||||
config.mailer_sender = ENV.fetch('OSEM_EMAIL_ADDRESS', 'no-reply@localhost')
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
# config.mailer = "Devise::Mailer"
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
default: &default
|
||||
id_site: <%= ENV['OSEM_PIWIK_ID'] %>
|
||||
url: <%= ENV['OSEM_PIWIK_URL'] %>
|
||||
use_async: <%= ENV['OSEM_PIWIK_ASYNC'] || false %>
|
||||
disabled: <%= ENV['OSEM_PIWIK_DISABLED'] || true %>
|
||||
hostname: <%= ENV['OSEM_PIWIK_HOSTNAME'] || 'localhost' %>
|
||||
use_async: <%= ENV.fetch('OSEM_PIWIK_ASYNC', false) %>
|
||||
disabled: <%= ENV.fetch('OSEM_PIWIK_DISABLED', true) %>
|
||||
hostname: <%= ENV.fetch('OSEM_PIWIK_HOSTNAME', 'localhost') %>
|
||||
|
||||
production:
|
||||
piwik:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Osem::Application.routes.draw do
|
|||
get '/', to: 'conferences#show'
|
||||
end
|
||||
|
||||
if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||
if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
|
||||
devise_for :users, controllers: { registrations: :registrations }
|
||||
else
|
||||
devise_for :users,
|
||||
|
|
@ -225,8 +225,8 @@ Osem::Application.routes.draw do
|
|||
|
||||
get '/calendar' => 'conferences#calendar'
|
||||
|
||||
unless ENV['OSEM_ROOT_CONFERENCE'].blank?
|
||||
root to: redirect("/conferences/#{ENV['OSEM_ROOT_CONFERENCE']}")
|
||||
if ENV.fetch('OSEM_ROOT_CONFERENCE', nil)
|
||||
root to: redirect("/conferences/#{ENV.fetch('OSEM_ROOT_CONFERENCE')}")
|
||||
else
|
||||
root to: 'conferences#index', via: [:get, :options]
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue