Sha256: 1714f240b29956ebe873d5b5eb3bf99df4411eb664bac485fe0d12e7ee4eec3f

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 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

2 entries across 2 versions & 1 rubygems

Version Path
secrets_cli-0.3.1 lib/secrets_cli/vault/auth.rb
secrets_cli-0.3.0 lib/secrets_cli/vault/auth.rb