Sha256: 762f230e6dcf088d53f9cc9d898c2b1387f698ec353e9a7321a8548fce8fd939
Contents?: true
Size: 992 Bytes
Versions: 4
Compression:
Stored size: 992 Bytes
Contents
module Jets::Cfn::Resource::Codebuild::Project module FormatEnv def standardize_env_vars(vars, casing: :camelcase_keys) map = { PARAMETER_STORE: "PARAMETER_STORE", SECRET: "SECRETS_MANAGER", SECRETS_MANAGER: "SECRETS_MANAGER", SSM: "PARAMETER_STORE" } vars = vars.reject { |k, v| v.nil? } # There's no map! method. So using map and then assigning to vars vars = vars.map do |k, v| starts_with = v.to_s.split(":").first value = if map.key?(starts_with.upcase.to_sym) v.to_s.sub("#{starts_with}:", "") else v end type = map[starts_with.upcase.to_sym] || "PLAINTEXT" { Name: k.to_s, Value: value, Type: type } end vars = vars.sort_by { |h| h[:Name].to_s } if casing == :underscore_keys vars.map! { |h| h.transform_keys { |k| k.to_s.underscore.to_sym } } end vars end end end
Version data entries
4 entries across 4 versions & 1 rubygems