21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-28 23:10:49 +02:00

Supports configuration variables per instance in config/chexpire.yml

This commit is contained in:
Colin Darie 2018-05-23 16:23:34 +02:00
parent f2891c2d6a
commit d9dfb0ee0f
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
9 changed files with 27 additions and 1 deletions

1
.gitignore vendored
View file

@ -25,6 +25,7 @@
# Ignore master key for decrypting credentials and more.
/config/master.key
/config/database.yml
/config/chexpire.yml
/public/packs
/public/packs-test
/node_modules

View file

@ -14,6 +14,7 @@ addons:
before_install:
- cp config/database.example.yml config/database.yml
- cp config/chexpire.test.yml config/chexpire.yml
install:
- bundle install

View file

@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
default from: Rails.configuration.chexpire.fetch("mailer_default_from")
layout "mailer"
end

View file

@ -31,5 +31,7 @@ module Chexpire
end
config.time_zone = "Europe/Paris"
config.chexpire = config_for(:chexpire)
end
end

View file

@ -0,0 +1,13 @@
default: &default
mailer_default_from: "from@example.org"
production:
<<: *default
host: "example.org"
development:
<<: *default
host: "chexpire.local"
# test configuration included in file used by CI services
<%= IO.read Rails.root.join("config", "chexpire.test.yml") %>

3
config/chexpire.test.yml Normal file
View file

@ -0,0 +1,3 @@
test:
mailer_default_from: "contact@chexpire.org"
host: "localhost"

View file

@ -37,6 +37,8 @@ Rails.application.configure do
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: config.chexpire.fetch("host"), port: 3000 }
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

View file

@ -66,6 +66,8 @@ Rails.application.configure do
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = { host: config.chexpire.fetch("host") }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true

View file

@ -38,6 +38,8 @@ Rails.application.configure do
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: config.chexpire.fetch("host"), port: 3000 }
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr