From 1352cde32122399b5f061af20be4e92a3c045767 Mon Sep 17 00:00:00 2001 From: Fabrice Gangler Date: Wed, 15 Jul 2020 16:53:22 +0200 Subject: [PATCH] Feat: allow emails senders to be configured in .env file Refs: #5408 --- config/env.example.optional | 8 ++++++++ config/initializers/contacts.rb | 12 ++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/config/env.example.optional b/config/env.example.optional index 40e5b7e82..20748e4be 100644 --- a/config/env.example.optional +++ b/config/env.example.optional @@ -6,5 +6,13 @@ APPLICATION_NAME="demarches-simplifiees.fr" APPLICATION_SHORTNAME="d-s.fr" APPLICATION_BASE_URL="https://www.demarches-simplifiees.fr" +# Personnalisation d'instance - Adresses Email de l'application et téléphone +# CONTACT_EMAIL="" +# EQUIPE_EMAIL="" +# TECH_EMAIL="" +# NO_REPLY_EMAIL="" +# OLD_CONTACT_EMAIL="" +# CONTACT_PHONE="" + # Personnalisation d'instance - Page externe "Disponibilité" (status page) # STATUS_PAGE_URL="" diff --git a/config/initializers/contacts.rb b/config/initializers/contacts.rb index 31ee422a6..0c94d76f5 100644 --- a/config/initializers/contacts.rb +++ b/config/initializers/contacts.rb @@ -1,12 +1,12 @@ # rubocop:disable DS/ApplicationName # todo: will be externally configurable if !defined?(CONTACT_EMAIL) - CONTACT_EMAIL = "contact@demarches-simplifiees.fr" - EQUIPE_EMAIL = "equipe@demarches-simplifiees.fr" - TECH_EMAIL = "tech@demarches-simplifiees.fr" - NO_REPLY_EMAIL = "Ne pas répondre " - CONTACT_PHONE = "01 76 42 02 87" + CONTACT_EMAIL = ENV.fetch("CONTACT_EMAIL", "contact@demarches-simplifiees.fr") + EQUIPE_EMAIL = ENV.fetch("EQUIPE_EMAIL", "equipe@demarches-simplifiees.fr") + TECH_EMAIL = ENV.fetch("TECH_EMAIL", "tech@demarches-simplifiees.fr") + NO_REPLY_EMAIL = ENV.fetch("NO_REPLY_EMAIL", "Ne pas répondre ") + CONTACT_PHONE = ENV.fetch("CONTACT_PHONE", "01 76 42 02 87") - OLD_CONTACT_EMAIL = "contact@tps.apientreprise.fr" + OLD_CONTACT_EMAIL = ENV.fetch("OLD_CONTACT_EMAIL", "contact@tps.apientreprise.fr") end # rubocop:enable DS/ApplicationName