Sha256: 935e2d5c2e3660eb8058985fe2b1744faaf519cb32a0bba330101e88750ab2be

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents

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

      def initialize(options)
        super
        @auth_token = options.auth_token || ENV['SECRETS_VAULT_AUTH_TOKEN']
        @auth_method = options.auth_method || ENV['SECRETS_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

3 entries across 3 versions & 1 rubygems

Version Path
secrets_cli-0.2.0 lib/secrets_cli/vault/auth.rb
secrets_cli-0.1.1 lib/secrets_cli/vault/auth.rb
secrets_cli-0.1.0 lib/secrets_cli/vault/auth.rb