gitlab-org--gitlab-foss/lib/ci/mask_secret.rb

11 lines
201 B
Ruby
Raw Normal View History

2016-09-19 06:38:03 -04:00
module Ci::MaskSecret
class << self
2016-09-20 09:41:41 -04:00
def mask!(value, token)
2016-09-20 11:07:34 -04:00
return value unless value.present? && token.present?
2016-09-19 06:38:03 -04:00
2016-09-20 09:41:41 -04:00
value.gsub!(token, 'x' * token.length)
2016-09-20 11:07:34 -04:00
value
2016-09-19 06:38:03 -04:00
end
end
end