Fix use of fallback certs
We used to always use nginx cert dir. When custom fallback certs were set, we used to copy it in boxdata cert dir and then nginx cert dir. The issue is then that we have to copy all certs to nginx cert dir on cloudron restore. To fix this, we simply give priority to nginx cert dir and not copy around certs anymore. caas cert will reside in nginx cert dir and not get backed up, as expected.
This commit is contained in:
@@ -158,11 +158,11 @@ function get(domain, callback) {
|
||||
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new DomainError(DomainError.NOT_FOUND));
|
||||
if (error) return callback(new DomainError(DomainError.INTERNAL_ERROR, error));
|
||||
|
||||
reverseProxy.getFallbackCertificate(domain, function (error, certFilePath, keyFilePath) {
|
||||
reverseProxy.getFallbackCertificate(domain, function (error, bundle) {
|
||||
if (error && error.reason !== ReverseProxyError.NOT_FOUND) return callback(new DomainError(DomainError.INTERNAL_ERROR, error));
|
||||
|
||||
var cert = safe.fs.readFileSync(certFilePath, 'utf-8');
|
||||
var key = safe.fs.readFileSync(keyFilePath, 'utf-8');
|
||||
var cert = safe.fs.readFileSync(bundle.certFilePath, 'utf-8');
|
||||
var key = safe.fs.readFileSync(bundle.keyFilePath, 'utf-8');
|
||||
|
||||
if (!cert || !key) return callback(new DomainError(DomainError.INTERNAL_ERROR, error));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user