diff --git a/config/environments/development.rb b/config/environments/development.rb index 31dc633..7aa10e2 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -83,4 +83,7 @@ Rails.application.configure do # URL to fetch reviews from the Ubuntu JSON API # config.ubuntu_reviews_api_url = 'https://reviews.ubuntu.com/reviews/api/1.0/reviews/filter/en/any/any/any/%s' + + # Needed (at least) for devise.rb to determine the oauth2 callback URL + config.base_url = ENV['DEBSHOTS_BASE_URL'] || 'http://localhost:3000' end diff --git a/config/environments/production.rb b/config/environments/production.rb index 3db08ce..9e85171 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -126,4 +126,7 @@ Rails.application.configure do # Any action dealing with authentication should redirect to HTTPS # Disabled because it will redirect incorrectly behind a proxy. # config.to_prepare { Devise::SessionsController.force_ssl } + + # Needed (at least) for devise.rb to determine the oauth2 callback URL + config.base_url = ENV['DEBSHOTS_BASE_URL'] || 'http://localhost:3000' end diff --git a/config/environments/test.rb b/config/environments/test.rb index f99f9f7..9434e4c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -57,4 +57,7 @@ Rails.application.configure do # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # Needed (at least) for devise.rb to determine the oauth2 callback URL + config.base_url = ENV['DEBSHOTS_BASE_URL'] || 'http://localhost:3000' end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 7f725cf..ce8de04 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -300,12 +300,13 @@ Devise.setup do |config| host: "salsa.debian.org", identifier: ENV['GITLAB_OAUTH_KEY'], secret: ENV['GITLAB_OAUTH_SECRET'], - redirect_uri: "http://localhost:3000/users/auth/salsa/callback", + #redirect_uri: "http://localhost:3000/users/auth/salsa/callback", + redirect_uri: "#{Rails.configuration.base_url}/users/auth/salsa/callback", ssl: { ca_path: '/etc/ssl/certs'} } } - OpenIDConnect.logger = Rails.logger - OmniAuth.config.logger = Rails.logger if Rails.env.development? + #OpenIDConnect.logger = Rails.logger + #OmniAuth.config.logger = Rails.logger if Rails.env.development? # config.omniauth :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"], # :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}