From 3ace7e7395ff7ad58c1bed23e85494d6f69ef832 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Thu, 25 Jul 2024 21:42:41 +0100 Subject: [PATCH] Fix attempt --- Gemfile | 2 +- app/lib/hosting_environment.rb | 8 +------- config/application.rb | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index c0e44ae6e46..c68506576e5 100644 --- a/Gemfile +++ b/Gemfile @@ -182,10 +182,10 @@ group :test do end group :development, :test do + gem 'dotenv-rails', require: 'dotenv/load' gem 'brakeman' gem 'bullet', require: false gem 'db-query-matchers' - gem 'dotenv-rails', require: false gem 'parallel_tests' gem 'pry-byebug' gem 'pry-rails' diff --git a/app/lib/hosting_environment.rb b/app/lib/hosting_environment.rb index 6886dceba1a..f262fef41cb 100644 --- a/app/lib/hosting_environment.rb +++ b/app/lib/hosting_environment.rb @@ -13,13 +13,7 @@ def self.application_url if Rails.env.production? "https://#{hostname}" else - require 'dotenv/rails' - # Foreman will override $PORT to 3100, 3200 etc depending on position in - # the Procfile. This means that e.g. emails sent via Sidekiq in - # development will have the wrong port number on them and the links won't - # work. Go back to .env and friends for the original port so the URL is - # consistent across processes. - "http://localhost:#{Dotenv.parse.fetch('PORT', 3000)}" + "http://localhost:#{ENV.fetch('PORT', 3000)}" end end diff --git a/config/application.rb b/config/application.rb index 2ff6909e609..90ab1725e81 100644 --- a/config/application.rb +++ b/config/application.rb @@ -18,7 +18,6 @@ # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) -require "dotenv/rails" require "./app/lib/hosting_environment" require "./app/middlewares/redirect_to_service_gov_uk_middleware"