Skip to content

Commit

Permalink
ID-46: certs base path is ignored by apigw:deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
mlookaxw committed Jun 24, 2020
1 parent a1ad906 commit f2423a8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
[cols="1,2,<10a", options="header"]
|===
|ID|Type|Description
|https://github.com/Axway-API-Management-Plus/apigw-maven-plugin/issues/40[#41]
|https://github.com/Axway-API-Management-Plus/apigw-maven-plugin/issues/41[#41]
|Enhancement
|Improve error message in case of wrong certificate passphrase.

|https://github.com/Axway-API-Management-Plus/apigw-maven-plugin/issues/46[#46]
|Bug
|Base path for certificates is ignored by `apigw:deploy` goal (server or policy projects).

If the `apigw:deploy` goal is executed for server or policy projects, the configuration of the base path for certificates is ignored.
|===

== Version 1.0.0
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/axway/maven/apigw/AbstractGatewayMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ public abstract class AbstractGatewayMojo extends AbstractMojo {
@Parameter(property = "axway.config.certs.basedir", required = false)
protected File configCertsBaseDir = null;

@Parameter(property = "axway.tools.cfg.cert.expirationDays", required = false)
protected int certExpirationDays = 10;

@Parameter(property = "axway.tools.cfg.cert.updateConfigured", required = false)
protected boolean updateCertConfigFile = false;

@Parameter(property = "axway.config.secrets.file", required = false)
protected File configSecretsFile = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;

import com.axway.maven.apigw.utils.FedBuilder;
Expand All @@ -29,12 +28,6 @@ public class DeploymentArchiveMojo extends AbstractFlattendProjectArchiveMojo {

private Artifact serverArchive;

@Parameter(property = "axway.tools.cfg.cert.expirationDays", required = false)
private int certExpirationDays = 10;

@Parameter(property = "axway.tools.cfg.cert.updateConfigured", required = false)
private boolean updateCertConfigFile = false;

@Override
protected String getArchiveExtension() {
return PackageType.DEPLOYMENT.getExtension();
Expand Down Expand Up @@ -171,7 +164,7 @@ private void buildFedArchive(File targetDir, File srcPolFile, File srcEnvFile, F
}
if (this.configSecretsFile != null) {
if (this.configSecretsKey == null)
throw new MojoExecutionException("Passphrase for secrets file not specified!");
throw new MojoExecutionException("Key file for secrets is not specified!");
fedBuilder.setSecrets(this.configSecretsFile, this.configSecretsKey);
}

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/axway/maven/apigw/DeploymentMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,14 @@ private File configFed(File pol, File env, File info) throws MojoExecutionExcept

fb.addPropertyFiles(getPropertyFiles());

fb.setCertificatesFile(this.configCertsFile);
fb.enableVerboseMode(this.verboseCfgTools);

if (this.configCertsFile != null) {
fb.setCertificatesFile(this.configCertsFile);
fb.setCertificateExpirationDays(this.certExpirationDays);
fb.enableCertificateConfigFileUpdate(this.updateCertConfigFile);
fb.setCertificatesBasePath(this.configCertsBaseDir);
}
if (this.configSecretsFile != null) {
if (this.configSecretsKey == null)
throw new MojoExecutionException("Key file for secrets is not specified!");
Expand Down

0 comments on commit f2423a8

Please sign in to comment.