Merge pull request #2411 from tchak/activate-dotenv-in-all-envirenements
Activate dotenv in all envirenements
This commit is contained in:
commit
61099282ea
7 changed files with 19 additions and 11 deletions
4
Gemfile
4
Gemfile
|
@ -1,5 +1,7 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
# dotenv should always be loaded before rails
|
||||
gem 'dotenv-rails', require: 'dotenv/rails-now'
|
||||
gem 'rails'
|
||||
|
||||
# Use SCSS for stylesheets
|
||||
|
@ -171,7 +173,5 @@ group :development, :test do
|
|||
# Deploy
|
||||
gem 'mina', ref: '343a7', git: 'https://github.com/mina-deploy/mina.git'
|
||||
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'dotenv-rails'
|
||||
gem 'rspec_junit_formatter'
|
||||
end
|
||||
|
|
|
@ -67,6 +67,12 @@ Dans le fichier `config/intializers/token.rb`, ajouter
|
|||
|
||||
*Note : les valeurs pour ces paramètres sont renseignées dans le Keepass*
|
||||
|
||||
## Bouchonnage de la configuration
|
||||
|
||||
Créer le fichier de configuration avec les valeurs par défaut :
|
||||
|
||||
cp config/env.example .env
|
||||
|
||||
## Lancement de l'application
|
||||
|
||||
overmind start
|
||||
|
|
|
@ -50,6 +50,10 @@ module ApplicationHelper
|
|||
current_administrateur&.email
|
||||
end
|
||||
|
||||
def staging?
|
||||
ENV['APP_NAME'] == 'tps_dev'
|
||||
end
|
||||
|
||||
def root_path_for_profile(nav_bar_profile)
|
||||
case nav_bar_profile
|
||||
when :gestionnaire
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
%body
|
||||
= render partial: 'layouts/support_navigator_banner'
|
||||
= render partial: 'layouts/pre_maintenance'
|
||||
- if Rails.env == 'staging'
|
||||
- if staging?
|
||||
#beta
|
||||
Env Test
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
.page-wrapper
|
||||
= render partial: "layouts/support_navigator_banner"
|
||||
= render partial: 'layouts/pre_maintenance'
|
||||
- if Rails.env == "staging"
|
||||
- if staging?
|
||||
#beta
|
||||
Env Test
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ require 'rails/all'
|
|||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
Dotenv::Railtie.load
|
||||
|
||||
module TPS
|
||||
class Application < Rails::Application
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
|
@ -27,13 +29,7 @@ module TPS
|
|||
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
|
||||
config.assets.precompile += %w(.woff)
|
||||
|
||||
if Rails.env.production?
|
||||
URL = "https://www.demarches-simplifiees.fr/"
|
||||
elsif Rails.env.staging?
|
||||
URL = "https://dev.demarches-simplifiees.fr/"
|
||||
else
|
||||
URL = "http://localhost:3000/"
|
||||
end
|
||||
URL = ENV['APP_HOST'] || "http://localhost:3000/"
|
||||
|
||||
config.active_job.queue_adapter = :delayed_job
|
||||
|
||||
|
|
2
config/env.example
Normal file
2
config/env.example
Normal file
|
@ -0,0 +1,2 @@
|
|||
APP_NAME="tps_local"
|
||||
APP_HOST="http://localhost:3000/"
|
Loading…
Reference in a new issue