oauth_config = {}
begin
  config = Rails.application.config_for(:configuration)
  oauth_config = config.dig('oauth', 'openkylin') || {}
  raise 'oauth openkylin config missing' if oauth_config.blank?
rescue => ex
  raise ex if Rails.env.production?

  puts %Q{\033[33m [warning] openkylin oauth config or configuration.yml missing,
           please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
end

OpenkylinOauth.client_id = oauth_config['client_id']
OpenkylinOauth.client_secret = oauth_config['client_secret']
OpenkylinOauth.base_url = oauth_config['base_url']
OpenkylinOauth.redirect_uri = oauth_config['redirect_uri']
