Sha256: ae9a02e776c3bd424addd60fe971bfc47f0c18f79d6cbb0bed4cabd3406ef7e5
Contents?: true
Size: 882 Bytes
Versions: 13
Compression:
Stored size: 882 Bytes
Contents
# frozen_string_literal: true module Bolt class Plugin class EnvVar def initialize(*_args); end def name 'env_var' end def hooks hook_descriptions.keys end def hook_descriptions { resolve_reference: 'Read values stored in environment variables.', validate_resolve_reference: nil } end def validate_resolve_reference(opts) unless opts['var'] raise Bolt::ValidationError, "env_var plugin requires that the 'var' is specified" end return if opts['optional'] || opts['default'] unless ENV[opts['var']] raise Bolt::ValidationError, "env_var plugin requires that the var '#{opts['var']}' be set" end end def resolve_reference(opts) ENV[opts['var']] || opts['default'] end end end end
Version data entries
13 entries across 13 versions & 1 rubygems