From 249cbc449c301aef2a21117138d140efb17b0d96 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 3 Jun 2024 05:15:58 -0400 Subject: [PATCH] Use existing config access to `local_domain` value (#30509) --- app/views/auth/registrations/edit.html.haml | 2 +- app/views/errors/self_destruct.html.haml | 2 +- spec/requests/well_known/oauth_metadata_spec.rb | 2 +- spec/support/signed_request_helpers.rb | 2 +- spec/system/profile_spec.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/auth/registrations/edit.html.haml b/app/views/auth/registrations/edit.html.haml index 48350f478e..07d6c1af51 100644 --- a/app/views/auth/registrations/edit.html.haml +++ b/app/views/auth/registrations/edit.html.haml @@ -3,7 +3,7 @@ - if self_destruct? .flash-message.warning - = t('auth.status.self_destruct', domain: ENV.fetch('LOCAL_DOMAIN')) + = t('auth.status.self_destruct', domain: Rails.configuration.x.local_domain) - else = render partial: 'status', locals: { user: @user, strikes: @strikes } diff --git a/app/views/errors/self_destruct.html.haml b/app/views/errors/self_destruct.html.haml index 09b17a5a94..b9ff48f684 100644 --- a/app/views/errors/self_destruct.html.haml +++ b/app/views/errors/self_destruct.html.haml @@ -3,7 +3,7 @@ .simple_form %h1.title= t('self_destruct.title') - %p.lead= t('self_destruct.lead_html', domain: ENV.fetch('LOCAL_DOMAIN')) + %p.lead= t('self_destruct.lead_html', domain: Rails.configuration.x.local_domain) .form-footer %ul.no-list diff --git a/spec/requests/well_known/oauth_metadata_spec.rb b/spec/requests/well_known/oauth_metadata_spec.rb index deef189ac9..3350d59315 100644 --- a/spec/requests/well_known/oauth_metadata_spec.rb +++ b/spec/requests/well_known/oauth_metadata_spec.rb @@ -6,7 +6,7 @@ describe 'The /.well-known/oauth-authorization-server request' do let(:protocol) { ENV.fetch('LOCAL_HTTPS', true) ? :https : :http } before do - host! ENV.fetch('LOCAL_DOMAIN') + host! Rails.configuration.x.local_domain end it 'returns http success with valid JSON response' do diff --git a/spec/support/signed_request_helpers.rb b/spec/support/signed_request_helpers.rb index eba4095e43..8a52179cae 100644 --- a/spec/support/signed_request_helpers.rb +++ b/spec/support/signed_request_helpers.rb @@ -6,7 +6,7 @@ module SignedRequestHelpers headers ||= {} headers['Date'] = Time.now.utc.httpdate - headers['Host'] = ENV.fetch('LOCAL_DOMAIN') + headers['Host'] = Rails.configuration.x.local_domain signed_headers = headers.merge('(request-target)' => "get #{path}").slice('(request-target)', 'Host', 'Date') key_id = ActivityPub::TagManager.instance.key_uri_for(sign_with) diff --git a/spec/system/profile_spec.rb b/spec/system/profile_spec.rb index 421b68a169..2517e823b5 100644 --- a/spec/system/profile_spec.rb +++ b/spec/system/profile_spec.rb @@ -7,7 +7,7 @@ describe 'Profile' do subject { page } - let(:local_domain) { ENV['LOCAL_DOMAIN'] } + let(:local_domain) { Rails.configuration.x.local_domain } before do as_a_logged_in_user