diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-01 17:36:25 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-01 17:36:25 +0400 |
commit | 5db3468d7eb3224bb37ecf670ee2216a693d1a0f (patch) | |
tree | 7202482e556415c2d9fb890669832f9fddaed31e /config | |
parent | 5e004719c44edee3b6ab7921b016fd0044bad8b4 (diff) | |
parent | 7863319b97498a7621815cfe5691794ecb86b8c5 (diff) |
Merge pull request #5957 from ninech/dont-depend-on-appid-and-appsecret
refactor omniauth configuration method
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/devise.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 25390978cf6..e12f07fa6fc 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -227,15 +227,21 @@ Devise.setup do |config| end Gitlab.config.omniauth.providers.each do |provider| + provider_arguments = [] + + %w[app_id app_secret].each do |argument| + provider_arguments << provider[argument] if provider[argument] + end + case provider['args'] when Array # An Array from the configuration will be expanded. - config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'], *provider['args'] + provider_arguments.concat provider['args'] when Hash # A Hash from the configuration will be passed as is. - config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'], provider['args'] - else - config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'] + provider_arguments << provider['args'] end + + config.omniauth provider['name'].to_sym, *provider_arguments end end |