diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-09-27 09:25:36 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-09-27 09:28:53 +0200 |
commit | 64bee2878284cd2a1e604cb0cea02194c38c8df5 (patch) | |
tree | 2a9e6d4b4565b221c198891cd3aa5ed33ad13f8c /vespa-maven-plugin | |
parent | 9b4fa7c95262c3101b8b488f766c7cec4aae135d (diff) |
Respect VESPA_CLI_HOME in Maven plugin
Diffstat (limited to 'vespa-maven-plugin')
-rw-r--r-- | vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java index 50bdde28180..89597a2352a 100644 --- a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java +++ b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java @@ -108,7 +108,10 @@ public abstract class AbstractVespaMojo extends AbstractMojo { private Optional<Path> apiKeyPath(String tenant) { if (!isNullOrBlank(apiKeyFile)) return Optional.of(Paths.get(apiKeyFile)); - Path cliApiKeyFile = Paths.get(System.getProperty("user.home"), ".vespa", tenant + ".api-key.pem"); + Path cliApiKeyFile = Optional.ofNullable(System.getenv("VESPA_CLI_HOME")) + .map(Paths::get) + .orElseGet(() -> Paths.get(System.getProperty("user.home"), ".vespa")) + .resolve(tenant + ".api-key.pem"); if (Files.exists(cliApiKeyFile)) return Optional.of(cliApiKeyFile); return Optional.empty(); |