Load OmniauthTenantSetup inside a lambda
This way we avoid loading the OmniauthTenantSetup in the initializer, which could be problematic when switching to Zeitwerk.
This commit is contained in:
@@ -1,28 +1,20 @@
|
|||||||
module OmniauthTenantSetup
|
module OmniauthTenantSetup
|
||||||
class << self
|
class << self
|
||||||
def twitter
|
def twitter(env)
|
||||||
->(env) do
|
|
||||||
oauth(env, secrets.twitter_key, secrets.twitter_secret)
|
oauth(env, secrets.twitter_key, secrets.twitter_secret)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def facebook
|
def facebook(env)
|
||||||
->(env) do
|
|
||||||
oauth2(env, secrets.facebook_key, secrets.facebook_secret)
|
oauth2(env, secrets.facebook_key, secrets.facebook_secret)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def google_oauth2
|
def google_oauth2(env)
|
||||||
->(env) do
|
|
||||||
oauth2(env, secrets.google_oauth2_key, secrets.google_oauth2_secret)
|
oauth2(env, secrets.google_oauth2_key, secrets.google_oauth2_secret)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def wordpress_oauth2
|
def wordpress_oauth2(env)
|
||||||
->(env) do
|
|
||||||
oauth2(env, secrets.wordpress_oauth2_key, secrets.wordpress_oauth2_secret)
|
oauth2(env, secrets.wordpress_oauth2_key, secrets.wordpress_oauth2_secret)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
@@ -270,22 +270,22 @@ Devise.setup do |config|
|
|||||||
config.omniauth :twitter,
|
config.omniauth :twitter,
|
||||||
Rails.application.secrets.twitter_key,
|
Rails.application.secrets.twitter_key,
|
||||||
Rails.application.secrets.twitter_secret,
|
Rails.application.secrets.twitter_secret,
|
||||||
setup: OmniauthTenantSetup.twitter
|
setup: ->(env) { OmniauthTenantSetup.twitter(env) }
|
||||||
config.omniauth :facebook,
|
config.omniauth :facebook,
|
||||||
Rails.application.secrets.facebook_key,
|
Rails.application.secrets.facebook_key,
|
||||||
Rails.application.secrets.facebook_secret,
|
Rails.application.secrets.facebook_secret,
|
||||||
scope: "email",
|
scope: "email",
|
||||||
info_fields: "email,name,verified",
|
info_fields: "email,name,verified",
|
||||||
setup: OmniauthTenantSetup.facebook
|
setup: ->(env) { OmniauthTenantSetup.facebook(env) }
|
||||||
config.omniauth :google_oauth2,
|
config.omniauth :google_oauth2,
|
||||||
Rails.application.secrets.google_oauth2_key,
|
Rails.application.secrets.google_oauth2_key,
|
||||||
Rails.application.secrets.google_oauth2_secret,
|
Rails.application.secrets.google_oauth2_secret,
|
||||||
setup: OmniauthTenantSetup.google_oauth2
|
setup: ->(env) { OmniauthTenantSetup.google_oauth2(env) }
|
||||||
config.omniauth :wordpress_oauth2,
|
config.omniauth :wordpress_oauth2,
|
||||||
Rails.application.secrets.wordpress_oauth2_key,
|
Rails.application.secrets.wordpress_oauth2_key,
|
||||||
Rails.application.secrets.wordpress_oauth2_secret,
|
Rails.application.secrets.wordpress_oauth2_secret,
|
||||||
client_options: { site: Rails.application.secrets.wordpress_oauth2_site },
|
client_options: { site: Rails.application.secrets.wordpress_oauth2_site },
|
||||||
setup: OmniauthTenantSetup.wordpress_oauth2
|
setup: ->(env) { OmniauthTenantSetup.wordpress_oauth2(env) }
|
||||||
|
|
||||||
# ==> Warden configuration
|
# ==> Warden configuration
|
||||||
# If you want to use other strategies, that are not supported by Devise, or
|
# If you want to use other strategies, that are not supported by Devise, or
|
||||||
|
|||||||
Reference in New Issue
Block a user