You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/config/initializers/account_config_env_override...

16 lines
673 B

# frozen_string_literal: true
# Seeds DOCUSEAL_CONFIG_* env overrides into every existing account on boot.
# New accounts receive overrides via Account#after_create_commit.
#
# Runs only when at least one override env var is set and the accounts table is ready.
Rails.application.config.after_initialize do
next if Rails.env.test?
next unless ActiveRecord::Base.connection.data_source_exists?('accounts')
next if Account.env_config_overrides.empty?
Account.find_each(&:apply_env_config_overrides)
rescue ActiveRecord::NoDatabaseError, ActiveRecord::StatementInvalid => e
Rails.logger.warn("[account_config_env_overrides] skipped: #{e.class}: #{e.message}")
end