From 9c7e3a9ed0d55fdf1845a2a9b36d5b53fc591e4f Mon Sep 17 00:00:00 2001 From: Jason Gwartz Date: Thu, 2 May 2019 16:46:09 +0200 Subject: [PATCH] Fixes error when '~/.vault-token' contains a trailing newline First of all, thanks for the great tool! This PR fixes an error encountered by one of our developers which occured when they had manually created the `~/.vault-token` file, and their editor had added a trailing newline. The error comes from the following line: https://github.com/hashicorp/vault/blob/master/api/client.go#L747 The official vault client was patched for this in https://github.com/hashicorp/vault/commit/f8c657a80a6b8e6dc5baa06febe0b67f00ced96e, after issues https://github.com/hashicorp/vault/issues/1774 and https://github.com/hashicorp/vault/issues/1902. --- cmd/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index 011ccaf..fd07d51 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -116,5 +116,5 @@ func vaultTokenFromDisk() string { return "" } - return string(data) + return strings.TrimSpace(string(data)) }