* Fix typo * Add SMTP configs to Settings::General * Expand Settings's show page * Expand Settings::General's constants * Move smtp_enabled? logic to ApplicationMailer * Apply suggestions from code review Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com> * Add missing descriptions and placeholders * Remove production guard clause * Change delivery_method to a callback * Create Settings::SMTP * Run migration * Move constants * Remove SMTP from Settings::General * Create SMTPSettingsController * Add back guard clause * Change which perform_deliveries configuration to use from * Update config/environments/production.rb * Rename migration to singular * Run migration again * Fix name * Alphabetize and add validation for authentication * Move settings and enabled? logic to Settings::SMTP * Change after_action to before_action * Fix broken spec * Fix broken spec * Create SMTP specs * Provide default for port * Create spec for ApplicationMailer * Fix broken spec * Move smtp_enabled? * Search and replace Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
30 lines
898 B
Ruby
30 lines
898 B
Ruby
class ForemInstance
|
|
def self.deployed_at
|
|
@deployed_at ||= ApplicationConfig["RELEASE_FOOTPRINT"].presence ||
|
|
ENV["HEROKU_RELEASE_CREATED_AT"].presence ||
|
|
Time.current.to_s
|
|
end
|
|
|
|
def self.latest_commit_id
|
|
@latest_commit_id ||= ApplicationConfig["FOREM_BUILD_SHA"].presence || ENV["HEROKU_SLUG_COMMIT"].presence
|
|
end
|
|
|
|
def self.email
|
|
ApplicationConfig["DEFAULT_EMAIL"]
|
|
end
|
|
|
|
# Return true if we are operating on a local installation, false otherwise
|
|
def self.local?
|
|
Settings::General.app_domain.include?("localhost")
|
|
end
|
|
|
|
# Used where we need to keep old DEV features around but don't want to/cannot
|
|
# expose them to other communities.
|
|
def self.dev_to?
|
|
Settings::General.app_domain == "dev.to"
|
|
end
|
|
|
|
def self.smtp_enabled?
|
|
(Settings::SMTP.user_name.present? && Settings::SMTP.password.present?) || ENV["SENDGRID_API_KEY"].present?
|
|
end
|
|
end
|