Move env-specific bits to env files
TIL Rails engines load these by default before loading the host app's
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
require_relative "production"
|
||||
|
||||
Rails.application.configure do
|
||||
config.action_mailer.smtp_settings[:domain] = "fizzy-beta.37signals.com"
|
||||
config.action_mailer.smtp_settings[:address] = "smtp-outbound-staging"
|
||||
config.action_mailer.default_url_options = { host: "fizzy-beta.37signals.com", protocol: "https" }
|
||||
config.action_controller.default_url_options = { host: "fizzy-beta.37signals.com", protocol: "https" }
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
Rails.application.configure do
|
||||
if Rails.root.join("tmp/structured-logging.txt").exist?
|
||||
config.structured_logging.logger = ActiveSupport::Logger.new("log/structured-development.log")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
Rails.application.configure do
|
||||
config.active_storage.service = :purestorage
|
||||
config.structured_logging.logger = ActiveSupport::Logger.new(STDOUT)
|
||||
|
||||
config.action_controller.default_url_options = { host: "app.fizzy.do", protocol: "https" }
|
||||
config.action_mailer.default_url_options = { host: "app.fizzy.do", protocol: "https" }
|
||||
config.action_mailer.smtp_settings = { domain: "app.fizzy.do", address: "smtp-outbound", port: 25, enable_starttls_auto: false }
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
require_relative "production"
|
||||
|
||||
Rails.application.configure do
|
||||
config.action_mailer.smtp_settings[:domain] = "fizzy.37signals-staging.com"
|
||||
config.action_mailer.smtp_settings[:address] = "smtp-outbound-staging"
|
||||
config.action_mailer.default_url_options = { host: "fizzy.37signals-staging.com", protocol: "https" }
|
||||
config.action_controller.default_url_options = { host: "fizzy.37signals-staging.com", protocol: "https" }
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
require "fizzy/saas/testing"
|
||||
@@ -7,28 +7,37 @@ module Fizzy
|
||||
# moved from config/initializers/queenbee.rb
|
||||
Queenbee.host_app = Fizzy
|
||||
|
||||
initializer "fizzy_saas.settings", before: :load_config_initializers do |app|
|
||||
if Rails.env.local?
|
||||
if Rails.root.join("tmp/structured-logging.txt").exist?
|
||||
app.config.structured_logging.logger = ActiveSupport::Logger.new("log/structured-development.log")
|
||||
end
|
||||
else
|
||||
app.config.active_storage.service = :purestorage
|
||||
app.config.structured_logging.logger = ActiveSupport::Logger.new(STDOUT)
|
||||
end
|
||||
end
|
||||
|
||||
initializer "fizzy.saas.mount" do |app|
|
||||
app.routes.append do
|
||||
mount Fizzy::Saas::Engine => "/", as: "saas"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
initializer "fizzy_saas.transaction_pinning" do |app|
|
||||
app.config.middleware.insert_after(ActiveRecord::Middleware::DatabaseSelector, TransactionPinning::Middleware)
|
||||
end
|
||||
|
||||
initializer "fizzy_saas.solid_queue" do
|
||||
SolidQueue.on_start do
|
||||
Process.warmup
|
||||
Yabeda::Prometheus::Exporter.start_metrics_server!
|
||||
end
|
||||
end
|
||||
|
||||
initializer "fizzy_saas.logging.session" do |app|
|
||||
ActiveSupport.on_load(:action_controller_base) do
|
||||
before_action do
|
||||
if Current.identity.present?
|
||||
logger.struct(" Authorized Identity##{Current.identity.id}", authentication: { identity: { id: Current.identity.id } })
|
||||
end
|
||||
|
||||
if Current.account.present?
|
||||
logger.struct(account: { queenbee_id: Current.account.external_account_id })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
initializer "fizzy_saas.sentry" do
|
||||
if !Rails.env.local? && ENV["SKIP_TELEMETRY"].blank?
|
||||
Sentry.init do |config|
|
||||
@@ -60,34 +69,6 @@ module Fizzy
|
||||
require_relative "metrics"
|
||||
end
|
||||
|
||||
initializer "fizzy_saas.solid_queue" do
|
||||
SolidQueue.on_start do
|
||||
Process.warmup
|
||||
Yabeda::Prometheus::Exporter.start_metrics_server!
|
||||
end
|
||||
end
|
||||
|
||||
# Load test mocks automatically in test environment
|
||||
initializer "fizzy_saas.test_mocks", after: :load_config_initializers do
|
||||
if Rails.env.test?
|
||||
require "fizzy/saas/testing"
|
||||
end
|
||||
end
|
||||
|
||||
initializer "fizzy_saas.logging.session" do |app|
|
||||
ActiveSupport.on_load(:action_controller_base) do
|
||||
before_action do
|
||||
if Current.identity.present?
|
||||
logger.struct(" Authorized Identity##{Current.identity.id}", authentication: { identity: { id: Current.identity.id } })
|
||||
end
|
||||
|
||||
if Current.account.present?
|
||||
logger.struct(account: { queenbee_id: Current.account.external_account_id })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
config.to_prepare do
|
||||
::Signup.prepend(Fizzy::Saas::Signup)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user