aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-maven-plugin
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@verizonmedia.com>2019-10-04 16:42:34 +0200
committerØyvind Grønnesby <oyving@verizonmedia.com>2019-10-04 16:42:34 +0200
commit8fb369df028d841dd07cbeea8b155b44db583701 (patch)
tree6b5b37b88f1cdd7a9fc2382c7c6bedde014df287 /vespa-maven-plugin
parent273209ec7ff9fed1a532ae0b1b4dc53cd4ed43d3 (diff)
Let plugin get the key as parameter
Diffstat (limited to 'vespa-maven-plugin')
-rw-r--r--vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java14
1 files changed, 12 insertions, 2 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 bf8f6f83f53..080ac0b8173 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
@@ -34,7 +34,10 @@ public abstract class AbstractVespaMojo extends AbstractMojo {
@Parameter(property = "instance")
protected String instance;
- @Parameter(property = "privateKeyFile", required = true)
+ @Parameter(property = "privateKey")
+ protected String privateKey;
+
+ @Parameter(property = "privateKeyFile")
protected String privateKeyFile;
@Parameter(property = "certificateFile")
@@ -67,8 +70,15 @@ public abstract class AbstractVespaMojo extends AbstractMojo {
instance = firstNonBlank(instance, project.getProperties().getProperty("instance", "default"));
id = ApplicationId.from(tenant, application, instance);
+ if (privateKey == null) {
+ if (privateKeyFile == null || privateKeyFile.isEmpty()) {
+ throw new IllegalArgumentException("Missing 'privateKey' or 'privateKeyFile' properties.");
+ }
+ privateKey = Paths.get(privateKeyFile);
+ }
+
controller = certificateFile == null
- ? ControllerHttpClient.withSignatureKey(URI.create(endpoint), Paths.get(privateKeyFile), id)
+ ? ControllerHttpClient.withSignatureKey(URI.create(endpoint), privateKey, id)
: ControllerHttpClient.withKeyAndCertificate(URI.create(endpoint), Paths.get(privateKeyFile), Paths.get(certificateFile));
}