From 051950e04c3a36e9b1d6bd6e04e39ee0da7c19b4 Mon Sep 17 00:00:00 2001 From: Adrien Chauve Date: Wed, 24 Nov 2021 15:11:00 +0100 Subject: [PATCH] Remove references to deprecated application.yml config file. Point to .env and other .env.* config files. --- GETTING_STARTED.md | 2 +- config/environments/development.rb | 2 +- config/initializers/geocoder.rb | 2 +- config/schedule.rb | 8 +++----- lib/open_food_network/i18n_config.rb | 2 +- script/setup | 6 ------ 6 files changed, 7 insertions(+), 15 deletions(-) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index bab36e6fbe..b13938a14f 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -81,7 +81,7 @@ The tests of all custom engines can be run with: Note: If your OS is not explicitly supported in the setup guides then not all tests may pass. However, you may still be able to develop. -Note: The time zone on your machine should match the one defined in `config/application.yml`. +Note: The time zone on your machine should match the one defined in the `.env[.*]` file. Once [npm dependencies are installed][karma], AngularJS tests can be run with: diff --git a/config/environments/development.rb b/config/environments/development.rb index 4e405680a9..e233b84862 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -60,7 +60,7 @@ Openfoodnetwork::Application.configure do # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # - # To override this, set the appropriate locale in application.yml + # To override this, set the appropriate locale in .env[.*] file. config.time_zone = ENV.fetch("TIMEZONE", "UTC") config.i18n.fallbacks = [:en] diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb index 893f3d04ae..1d845f945c 100644 --- a/config/initializers/geocoder.rb +++ b/config/initializers/geocoder.rb @@ -1,5 +1,5 @@ # Google requires an API key with a billing account to use their API. -# The key is stored in config/application.yml. +# The key is stored in .env[.*] files. Geocoder.configure( timeout: ENV.fetch('GEOCODER_TIMEOUT', 6).to_i, diff --git a/config/schedule.rb b/config/schedule.rb index 1016d061bc..f2e1c951bb 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -3,9 +3,7 @@ require 'yaml' # Learn more: http://github.com/javan/whenever -app_config = YAML.load_file(File.join(__dir__, 'application.yml')) - -env "MAILTO", app_config["SCHEDULE_NOTIFICATIONS"] if app_config["SCHEDULE_NOTIFICATIONS"] +env "MAILTO", ENV["SCHEDULE_NOTIFICATIONS"] if ENV["SCHEDULE_NOTIFICATIONS"] # If we use -e with a file containing specs, rspec interprets it and filters out our examples job_type :run_file, "cd :path; :environment_variable=:environment bundle exec script/rails runner :task :output" @@ -15,9 +13,9 @@ every 1.month, at: '4:30am' do end every 1.day, at: '2:45am' do - rake 'db2fog:clean' if app_config['S3_BACKUPS_BUCKET'] + rake 'db2fog:clean' if ENV['S3_BACKUPS_BUCKET'] end every 4.hours do - rake 'db2fog:backup' if app_config['S3_BACKUPS_BUCKET'] + rake 'db2fog:backup' if ENV['S3_BACKUPS_BUCKET'] end diff --git a/lib/open_food_network/i18n_config.rb b/lib/open_food_network/i18n_config.rb index 92e48bd6d3..d0d71d0450 100644 --- a/lib/open_food_network/i18n_config.rb +++ b/lib/open_food_network/i18n_config.rb @@ -3,7 +3,7 @@ module OpenFoodNetwork # Provides access to the language settings. # Currently, language settings are read from the environment. - # See: config/application.yml + # See: .env[.*] files. class I18nConfig # Users don't need to select the already selected locale. def self.locale_options diff --git a/script/setup b/script/setup index cbacd2d6e6..73100989ad 100755 --- a/script/setup +++ b/script/setup @@ -34,12 +34,6 @@ fi bundle check || bundle install yarn install -# Set up configurable environment variables -if [ ! -f config/application.yml ]; then - cp config/application.yml.example config/application.yml - printf "${YELLOW}Copied config/application.yml Make sure to fill it with the appropriate configuration values.\n\n${NO_COLOR}" -fi - # Set up the database for both development and test # Confirming the default user and password printf '\n\n' | bundle exec rake db:setup db:test:prepare