Sha256: 30e8a50999644ae89e5f50a63181fe341f59e1093e5542aef5b0c87d35b954ae
Contents?: true
Size: 893 Bytes
Versions: 6
Compression:
Stored size: 893 Bytes
Contents
require 'colorize' module CanvasOauth module CanvasConfig mattr_accessor :key, :secret def self.load_config YAML::load(File.open(config_file))[Rails.env] end def self.config_file CanvasOauth.app_root.join('config/canvas.yml') end def self.setup! if File.exists?(config_file) Rails.logger.info "Initializing Qalam using configuration in #{config_file}" 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" 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 end end
Version data entries
6 entries across 6 versions & 1 rubygems