5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/services/uffizzi_core/compose_file/parsers/secrets_parser_service.rb', line 5
def parse(secrets_data)
return [] if secrets_data.nil?
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_type', option: :secrets) unless secrets_data.is_a?(Hash)
secrets = []
secrets_data.each_pair do |secret_name, secret_data|
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.secret_name_blank', option: secret_name) if secret_data['name'].blank?
if secret_data['external'] != true
raise UffizziCore::ComposeFile::ParseError,
I18n.t('compose.secret_external', secret: secret_name)
end
secrets << {
secret_name: secret_name,
secret_variable: secret_data['name'],
}
end
secrets
end
|