Skip to content

Commit

Permalink
fix(dashmate): zero ssl certificate draft not saved (#2297)
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov authored Oct 31, 2024
1 parent 5d82eca commit 453b30c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { ERRORS } from '../../../../ssl/zerossl/validateZeroSslCertificateFactor
* @param {VerificationServer} verificationServer
* @param {HomeDir} homeDir
* @param {validateZeroSslCertificate} validateZeroSslCertificate
* @param {ConfigFileJsonRepository} configFileRepository
* @param {ConfigFile} configFile
* @return {obtainZeroSSLCertificateTask}
*/
export default function obtainZeroSSLCertificateTaskFactory(
Expand All @@ -32,6 +34,8 @@ export default function obtainZeroSSLCertificateTaskFactory(
verificationServer,
homeDir,
validateZeroSslCertificate,
configFileRepository,
configFile,
) {
/**
* @typedef {obtainZeroSSLCertificateTask}
Expand Down Expand Up @@ -141,6 +145,9 @@ export default function obtainZeroSSLCertificateTaskFactory(
config.set('platform.gateway.ssl.enabled', true);
config.set('platform.gateway.ssl.provider', 'zerossl');
config.set('platform.gateway.ssl.providerConfigs.zerossl.id', ctx.certificate.id);

// Save config file
configFileRepository.write(configFile);
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ export default function validateZeroSslCertificateFactory(homeDir, getCertificat
}

if (['pending_validation', 'draft'].includes(data.certificate.status)) {
// Certificate is already created, so we just need to pass validation
// and download certificate file

// We need to download new certificate bundle
// We need to validate and download new certificate bundle
data.isBundleFilePresent = false;

return {
Expand All @@ -116,6 +113,9 @@ export default function validateZeroSslCertificateFactory(homeDir, getCertificat
};
}

// Certificate is already created at this point, so we just need to pass validation
// and download certificate file

if (data.certificate.status !== 'issued' || data.isExpiresSoon) {
// Certificate is going to expire soon, or current certificate is not valid
// we need to obtain a new one
Expand Down

0 comments on commit 453b30c

Please sign in to comment.