diff options
Diffstat (limited to 'app/models/clusters/integrations/prometheus.rb')
-rw-r--r-- | app/models/clusters/integrations/prometheus.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/clusters/integrations/prometheus.rb b/app/models/clusters/integrations/prometheus.rb index 899529ff49f..935d6238dba 100644 --- a/app/models/clusters/integrations/prometheus.rb +++ b/app/models/clusters/integrations/prometheus.rb @@ -26,7 +26,7 @@ module Clusters key: Settings.attr_encrypted_db_key_base_32, algorithm: 'aes-256-gcm' - default_value_for(:alert_manager_token) { SecureRandom.hex } + after_initialize :set_alert_manager_token, if: :new_record? scope :enabled, -> { where(enabled: true) } @@ -54,6 +54,10 @@ module Clusters private + def set_alert_manager_token + self.alert_manager_token = SecureRandom.hex + end + def activate_project_integrations ::Clusters::Applications::ActivateIntegrationWorker .perform_async(cluster_id, ::Integrations::Prometheus.to_param) |