2019-09-25 16:37:42 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-05-05 03:10:25 +02:00
|
|
|
require File.expand_path('../boot', __FILE__)
|
|
|
|
|
|
|
|
require 'csv'
|
2019-09-25 16:37:42 +02:00
|
|
|
require 'rails/all'
|
2016-03-23 18:39:41 +01:00
|
|
|
require 'elasticsearch/rails/instrumentation'
|
|
|
|
require 'elasticsearch/persistence/model'
|
2015-05-05 03:10:25 +02:00
|
|
|
|
2016-05-10 16:50:01 +02:00
|
|
|
|
2015-05-05 03:10:25 +02:00
|
|
|
# Require the gems listed in Gemfile, including any gems
|
|
|
|
# you've limited to :test, :development, or :production.
|
|
|
|
Bundler.require(*Rails.groups)
|
|
|
|
|
|
|
|
module Fablab
|
|
|
|
class Application < Rails::Application
|
2016-05-10 16:50:01 +02:00
|
|
|
require 'fab_manager'
|
2015-05-05 03:10:25 +02:00
|
|
|
# Settings in config/environments/* take precedence over those specified here.
|
|
|
|
# Application configuration should go into files in config/initializers
|
|
|
|
# -- all .rb files in that directory are automatically loaded.
|
|
|
|
|
|
|
|
# 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.
|
2016-03-23 18:39:41 +01:00
|
|
|
config.time_zone = Rails.application.secrets.time_zone
|
2015-05-05 03:10:25 +02:00
|
|
|
|
|
|
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
|
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
2016-03-23 18:39:41 +01:00
|
|
|
#
|
2016-04-11 11:31:32 +02:00
|
|
|
# /!\ ALL locales SHOULD be configured accordingly with this locale. /!\
|
2016-03-23 18:39:41 +01:00
|
|
|
#
|
|
|
|
config.i18n.default_locale = Rails.application.secrets.rails_locale
|
2017-04-27 18:35:00 +02:00
|
|
|
config.i18n.fallbacks = [Rails.application.secrets.app_locale, :en]
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2018-11-22 17:09:14 +01:00
|
|
|
config.assets.paths << Rails.root.join('node_modules').to_s
|
2015-05-05 03:10:25 +02:00
|
|
|
|
|
|
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
|
|
|
config.active_record.raise_in_transactional_callbacks = true
|
|
|
|
|
|
|
|
config.to_prepare do
|
2019-09-25 16:37:42 +02:00
|
|
|
Devise::Mailer.layout 'notifications_mailer'
|
2015-05-05 03:10:25 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# allow use rails helpers in angular templates
|
|
|
|
Rails.application.assets.context_class.class_eval do
|
|
|
|
include ActionView::Helpers
|
|
|
|
include Rails.application.routes.url_helpers
|
|
|
|
end
|
|
|
|
|
|
|
|
config.active_job.queue_adapter = :sidekiq
|
|
|
|
|
|
|
|
config.generators do |g|
|
|
|
|
g.orm :active_record
|
|
|
|
end
|
2016-03-23 18:39:41 +01:00
|
|
|
|
|
|
|
if Rails.env.development?
|
|
|
|
config.web_console.whitelisted_ips << '192.168.0.0/16'
|
2019-09-25 16:37:42 +02:00
|
|
|
config.web_console.whitelisted_ips << '192.168.99.0/16' # docker
|
|
|
|
config.web_console.whitelisted_ips << '10.0.2.2' # vagrant
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
|
2016-09-05 16:26:28 +02:00
|
|
|
# load locales for subdirectories
|
|
|
|
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**/*.yml').to_s]
|
|
|
|
|
2016-05-24 18:42:26 +02:00
|
|
|
# enable the app to find locales in plugins locales directory
|
2016-05-10 16:50:01 +02:00
|
|
|
config.i18n.load_path += Dir["#{Rails.root}/plugins/*/config/locales/*.yml"]
|
|
|
|
|
2016-05-24 18:42:26 +02:00
|
|
|
# enable the app to find views in plugins views directory
|
|
|
|
Dir["#{Rails.root}/plugins/*/views"].each do |path|
|
|
|
|
Rails.application.config.paths['app/views'] << path
|
|
|
|
end
|
|
|
|
|
2016-05-10 16:50:01 +02:00
|
|
|
FabManager.activate_plugins!
|
|
|
|
|
|
|
|
config.after_initialize do
|
2019-09-25 16:37:42 +02:00
|
|
|
plugins = FabManager.plugins
|
|
|
|
plugins&.each(&:notify_after_initialize)
|
2016-05-10 16:50:01 +02:00
|
|
|
end
|
2015-05-05 03:10:25 +02:00
|
|
|
end
|
|
|
|
end
|