summaryrefslogtreecommitdiff
path: root/app/models/project_auto_devops.rb
blob: 9a52edbff8ee24d4b9db274e99aade66e27dc247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class ProjectAutoDevops < ActiveRecord::Base
  belongs_to :project

  scope :enabled, -> { where(enabled: true) }
  scope :disabled, -> { where(enabled: false) }

  validates :domain, allow_blank: true, hostname: { allow_numeric_hostname: true }

  def has_domain?
    domain.present?
  end

  def variables
    variables = []
    variables << { key: 'AUTO_DEVOPS_DOMAIN', value: domain, public: true } if domain.present?
    variables
  end
end