Sha256: 649953e3ff555d8a03c2048d600ccf7798096060a2d39a1c5cdd723ba93356e4

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

module SecretsCli
  module Vault
    class Auth < SecretsCli::Vault::Base
      include SecretsCli::Helpers

      def initialize(options)
        super
        @auth_token = options.auth_token || ENV['VAULT_AUTH_TOKEN']
        @auth_method = options.auth_method || ENV['VAULT_AUTH_METHOD']
      end

      private

      attr_reader :auth_token, :auth_method

      def command
        case auth_method
        when 'github'
          "vault auth -method=github token=#{auth_token}"
        when 'token'
          "vault auth #{auth_token}"
        else
          error! "Unknown auth method #{auth_method}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
secrets_cli-0.4.0 lib/secrets_cli/vault/auth.rb