Merge pull request #2411 from tchak/activate-dotenv-in-all-envirenements

Activate dotenv in all envirenements
This commit is contained in:
gregoirenovel 2018-08-21 16:22:09 +02:00 committed by GitHub
commit 61099282ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
View file

@ -0,0 +1,2 @@
APP_NAME="tps_local"
APP_HOST="http://localhost:3000/"