summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2015-08-19 18:27:30 +0000
committerRobert Speicher <robert@gitlab.com>2015-08-19 18:27:30 +0000
commit1fdd1fa6ae7bd1bda3235bfa8685463fb5597646 (patch)
treedb3755b66fa1506d1f196fbf3819ec8d9ac82bea /app/models
parent34283ad1eb87f4a9041531237c7622686c56c5a6 (diff)
parent85f1cd2bdcfef93f8e843c735742150bfa199856 (diff)
downloadgitlab-ci-1fdd1fa6ae7bd1bda3235bfa8685463fb5597646.tar.gz
Merge branch 'variable-fix' into 'master'
Require the variable key to be set and unique See merge request !234
Diffstat (limited to 'app/models')
-rw-r--r--app/models/variable.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/variable.rb b/app/models/variable.rb
index b40fcbf..559b9f2 100644
--- a/app/models/variable.rb
+++ b/app/models/variable.rb
@@ -14,5 +14,8 @@
class Variable < ActiveRecord::Base
belongs_to :project
+ validates_presence_of :key
+ validates_uniqueness_of :key
+
attr_encrypted :value, mode: :per_attribute_iv_and_salt, key: GitlabCi::Application.secrets.db_key_base
end