Configure OSEM via environment variables

Instead of reading a yaml file we get configuration from the
environment.
This commit is contained in:
Henne Vogelsang 2016-03-22 18:14:40 +01:00
parent 45c31f210f
commit ebcb2780cd
17 changed files with 39 additions and 34 deletions

View file

@ -45,7 +45,7 @@ class Ability
# can view Commercials of confirmed Events
can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id)
can [:show, :create], User
unless CONFIG['authentication']['ichain']['enabled']
unless ENV['OSEM_ICHAIN_ENABLED'] == 'true'
can :show, Registration do |registration|
registration.new_record?
end

View file

@ -9,12 +9,12 @@ class EmailSettings < ActiveRecord::Base
'conference_start_date' => conference.start_date,
'conference_end_date' => conference.end_date,
'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registrations_url(
conference.short_title, host: CONFIG['url_for_emails']),
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')),
'conference_splash_link' => Rails.application.routes.url_helpers.conference_url(
conference.short_title, host: CONFIG['url_for_emails']),
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')),
'schedule_link' => Rails.application.routes.url_helpers.schedule_conference_url(
conference.short_title, host: CONFIG['url_for_emails'])
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000'))
}
if conference.program.cfp
@ -41,7 +41,7 @@ class EmailSettings < ActiveRecord::Base
if event
h['eventtitle'] = event.title
h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposal_index_url(
conference.short_title, host: CONFIG['url_for_emails'])
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000'))
end
h
end

View file

@ -19,7 +19,7 @@ class User < ActiveRecord::Base
# :lockable, :timeoutable and :omniauthable
devise_modules = []
if CONFIG['authentication']['ichain']['enabled']
if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
devise_modules += [ :ichain_authenticatable, :ichain_registerable, :omniauthable, omniauth_providers: [] ]
else
devise_modules += [:database_authenticatable, :registerable,