disable cert when feature flag is off, even if already provisioned
@@ -545,16 +545,17 @@ public class ApplicationController {
}
private Optional<ApplicationCertificate> getApplicationCertificate(Application application) {
- // Re-use certificate if already provisioned
- Optional<ApplicationCertificate> applicationCertificate = curator.readApplicationCertificate(application.id());
- if(applicationCertificate.isPresent())
- return applicationCertificate;
-
boolean provisionCertificate = provisionApplicationCertificate.with(FetchVector.Dimension.APPLICATION_ID,
application.id().serializedForm()).value();
if (!provisionCertificate) {
return Optional.empty();
}
+
+ // Re-use certificate if already provisioned
+ Optional<ApplicationCertificate> applicationCertificate = curator.readApplicationCertificate(application.id());
+ if(applicationCertificate.isPresent())
+ return applicationCertificate;
+
ApplicationCertificate newCertificate = applicationCertificateProvider.requestCaSignedCertificate(application.id());
curator.writeApplicationCertificate(application.id(), newCertificate);
