1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Simplify self host settings controller (#1230)

This commit is contained in:
Zach Gollwitzer 2024-10-02 12:07:56 -04:00 committed by GitHub
parent cb75c537fe
commit 7fabca4679
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 252 additions and 399 deletions

View file

@ -17,21 +17,7 @@ class Setting < RailsSettings::Base
default: ENV.fetch("UPGRADES_TARGET", "release"),
validates: { inclusion: { in: %w[release commit] } }
field :app_domain, type: :string, default: ENV["APP_DOMAIN"]
field :email_sender, type: :string, default: ENV["EMAIL_SENDER"]
field :synth_api_key, type: :string, default: ENV["SYNTH_API_KEY"]
field :require_invite_for_signup, type: :boolean, default: false
scope :smtp_settings do
field :smtp_host, type: :string, read_only: true, default: ENV["SMTP_ADDRESS"]
field :smtp_port, type: :string, read_only: true, default: ENV["SMTP_PORT"]
field :smtp_username, type: :string, read_only: true, default: ENV["SMTP_USERNAME"]
field :smtp_password, type: :string, read_only: true, default: ENV["SMTP_PASSWORD"]
end
def self.smtp_settings_populated?
Setting.defined_fields.select { |f| f.scope == :smtp_settings }.map(&:read).all?(&:present?)
end
end