Sha256: fa71fe189fc52876894ee359d66999083c447b9842c87a4947bbd5919306a372

Contents?: true

Size: 657 Bytes

Versions: 11

Compression:

Stored size: 657 Bytes

Contents

# frozen_string_literal: true

module Bolt
  class Plugin
    class EnvVar
      def initialize(*_args); end

      def name
        'env_var'
      end

      def hooks
        %i[resolve_reference validate_resolve_reference]
      end

      def validate_resolve_reference(opts)
        unless opts['var']
          raise Bolt::ValidationError, "env_var plugin requires that the 'var' is specified"
        end
        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']]
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bolt-2.6.0 lib/bolt/plugin/env_var.rb
bolt-2.5.0 lib/bolt/plugin/env_var.rb
bolt-2.4.0 lib/bolt/plugin/env_var.rb
bolt-2.3.1 lib/bolt/plugin/env_var.rb
bolt-2.3.0 lib/bolt/plugin/env_var.rb
bolt-2.2.0 lib/bolt/plugin/env_var.rb
bolt-2.1.0 lib/bolt/plugin/env_var.rb
bolt-2.0.1 lib/bolt/plugin/env_var.rb
bolt-2.0.0 lib/bolt/plugin/env_var.rb
bolt-1.49.0 lib/bolt/plugin/env_var.rb
bolt-1.48.0 lib/bolt/plugin/env_var.rb