14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/canvas_oauth/canvas_config.rb', line 14
def self.setup!
if File.exists?(config_file)
Rails.logger.info "Initializing Qalam using configuration in #{config_file}".green
config = load_config
self.key = config['key']
self.secret = config['secret']
elsif ENV['CANVAS_KEY'].present? && ENV['CANVAS_SECRET'].present?
Rails.logger.info "Initializing Qalam using environment vars CANVAS_KEY and CANVAS_SECRET".green
self.key = ENV['CANVAS_KEY']
self.secret = ENV['CANVAS_SECRET']
else
warn "Warning: Qalam key and secret not configured (RAILS_ENV = #{ENV['RAILS_ENV']})."
end
end
|