Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 07335b6a883..6a34f293a4a 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -274,6 +274,22 @@ class ApplicationSetting < ApplicationRecord
presence: true,
if: :lets_encrypt_terms_of_service_accepted?
+ validates :eks_integration_enabled,
+ inclusion: { in: [true, false] }
+
+ validates :eks_account_id,
+ format: { with: Gitlab::Regex.aws_account_id_regex,
+ message: Gitlab::Regex.aws_account_id_message },
+ if: :eks_integration_enabled?
+
+ validates :eks_access_key_id,
+ length: { in: 16..128 },
+ if: :eks_integration_enabled?
+
+ validates :eks_secret_access_key,
+ presence: true,
+ if: :eks_integration_enabled?
+
validates_with X509CertificateCredentialsValidator,
certificate: :external_auth_client_cert,
pkey: :external_auth_client_key,
@@ -304,6 +320,12 @@ class ApplicationSetting < ApplicationRecord
algorithm: 'aes-256-gcm',
encode: true
+ attr_encrypted :eks_secret_access_key,
+ mode: :per_attribute_iv,
+ key: Settings.attr_encrypted_db_key_base_truncated,
+ algorithm: 'aes-256-gcm',
+ encode: true
+
before_validation :ensure_uuid!
before_save :ensure_runners_registration_token