Drop Rails.application.secrets usage

That feature is gone and we already use environment variables...

https://github.com/rails/rails/pull/47801
This commit is contained in:
Henne Vogelsang 2025-08-12 14:37:45 +02:00
parent 4ec9aee5da
commit ddcd8dfc69
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
7 changed files with 9 additions and 89 deletions

View file

@ -14,11 +14,6 @@ module UsersHelper
providers = []
Devise.omniauth_providers.each do |provider|
provider_key = "#{provider}_key"
provider_secret = "#{provider}_secret"
unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
providers << provider
end
providers << provider if ENV.fetch("OSEM_#{provider.upcase}_KEY", nil).present? && ENV.fetch("OSEM_#{provider.upcase}_SECRET", nil).present?
end

View file

@ -23,5 +23,5 @@
%script.stripe-button{ src: "https://checkout.stripe.com/checkout.js",
data: { amount: @total_amount_to_pay.cents, label: "Pay #{humanized_money_with_symbol @total_amount_to_pay}",
email: current_user.email, currency: @total_amount_to_pay.currency, name: ENV.fetch('OSEM_NAME', 'OSEM'),
description: "book your tickets", key: Rails.application.secrets.stripe_publishable_key, locale: "auto"}}
description: "book your tickets", key: ENV.fetch('STRIPE_PUBLISHABLE_KEY'), locale: "auto"}}
= link_to 'Edit Purchase', conference_tickets_path(@conference.short_title), class: 'btn btn-default'

View file

@ -7,11 +7,9 @@ Devise.setup do |config|
# Pass each provider to User model in :omniauth_providers (for open_id providers use their name)
config.omniauth :open_id, name: 'suse', identifier: 'http://www.opensuse.org/openid/user'
config.omniauth :google_oauth2, ENV.fetch('OSEM_GOOGLE_KEY', Rails.application.secrets.google_key), ENV.fetch('OSEM_GOOGLE_SECRET', Rails.application.secrets.google_secret),
name: 'google',
scope: 'email'
config.omniauth :facebook, ENV.fetch('OSEM_FACEBOOK_KEY', Rails.application.secrets.facebook_key), ENV.fetch('OSEM_FACEBOOK_SECRET', Rails.application.secrets.facebook_secret)
config.omniauth :github, ENV.fetch('OSEM_GITHUB_KEY', Rails.application.secrets.github_key), ENV.fetch('OSEM_GITHUB_SECRET', Rails.application.secrets.github_secret)
config.omniauth :google_oauth2, ENV.fetch('OSEM_GOOGLE_KEY', nil), ENV.fetch('OSEM_GOOGLE_SECRET', nil), name: 'google', scope: 'email'
config.omniauth :facebook, ENV.fetch('OSEM_FACEBOOK_KEY', nil), ENV.fetch('OSEM_FACEBOOK_SECRET', nil)
config.omniauth :github, ENV.fetch('OSEM_GITHUB_KEY', nil), ENV.fetch('OSEM_GITHUB_SECRET', nil)
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,

View file

@ -1,5 +1,5 @@
Sentry.init do |config|
config.dsn = ENV.fetch('OSEM_SENTRY_DSN', Rails.application.secrets.sentry_dsn)
config.dsn = ENV.fetch('OSEM_SENTRY_DSN', nil)
config.breadcrumbs_logger = [:active_support_logger]
# To activate performance monitoring, set one of these options.

View file

@ -1 +1 @@
Stripe.api_key = Rails.application.secrets.stripe_secret_key
Stripe.api_key = ENV.fetch('STRIPE_SECRET_KEY', nil)

View file

@ -1,73 +0,0 @@
development:
# Generate your own with rake secret
# secret_key_base: '12345'
########## OMNIAUTH Providers ##########
# This is just sample data so mocks work
google_key: 'sample'
google_secret: 'sample'
facebook_key: 'sample'
facebook_secret: 'sample'
suse_key: 'sample'
suse_secret: 'sample'
# Register on stripe and add TEST keys here
# https://dashboard.stripe.com/account/apikeys
stripe_publishable_key: <%= ENV['STRIPE_PUBLISHABLE_KEY'] %>
stripe_secret_key: <%= ENV['STRIPE_SECRET_KEY'] %>
test:
# Generate your own with rake secret
# secret_key_base: '12345'
# Register on stripe and add TEST keys here
# https://dashboard.stripe.com/account/apikeys
stripe_publishable_key: <%= ENV['STRIPE_PUBLISHABLE_KEY'] %>
stripe_secret_key: <%= ENV['STRIPE_SECRET_KEY'] %>
production:
# Generate your own with rake secret or use the environment
# secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
# Your sentry.io DSN key
# sentry_dsn: '12345'
########## OMNIAUTH Providers ##########
# Leave the variables' names empty, unless you use the providers, in which
# case you need to register your applicaton and add the actual keys.
#
# If you add a provider, keep the format of the variables:
# *provider*_key and *provider*_secret
# If you add a provider that does not require a key, you still have to
# create the 2 variables with sample data or they won't show up in the app.
# Register your appllication with Google from
# https://code.google.com/apis/console#:access
google_key: ''
google_secret: ''
# Register your application with Facebook from
# https://developers.facebook.com/
facebook_key: ''
facebook_secret: ''
# Developers do not need to register their application for suse account to
# work. You must, however, add some sample value to the variables, for the
# login option to appear. For example:
#suse_key: 'sample data'
#suse_secret: 'sample data'
suse_key: ''
suse_secret: ''
# Register your application with GitHub from
# https://github.com/settings/applications
github_key: ''
github_secret: ''
# Register on stripe and add LIVE keys here
# https://dashboard.stripe.com/account/apikeys
stripe_publishable_key: <%= ENV['STRIPE_PUBLISHABLE_KEY'] %>
stripe_secret_key: <%= ENV['STRIPE_SECRET_KEY'] %>

View file

@ -42,7 +42,7 @@ feature Registration do
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
expect(purchase.quantity).to eq(2)
if Rails.application.secrets.stripe_publishable_key
if ENV.fetch('STRIPE_PUBLISHABLE_KEY', nil)
find('.stripe-button-el').click
stripe_iframe = all('iframe[name=stripe_checkout_app]').last
@ -81,7 +81,7 @@ feature Registration do
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
expect(purchase.quantity).to eq(2)
if Rails.application.secrets.stripe_publishable_key
if ENV.fetch('STRIPE_PUBLISHABLE_KEY', nil)
find('.stripe-button-el').click
stripe_iframe = all('iframe[name=stripe_checkout_app]').last
@ -172,7 +172,7 @@ feature Registration do
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
expect(purchase.quantity).to eq(2)
if Rails.application.secrets.stripe_publishable_key
if ENV.fetch('STRIPE_PUBLISHABLE_KEY', nil)
find('.stripe-button-el').click
stripe_iframe = all('iframe[name=stripe_checkout_app]').last