reverseproxy: async'ify

This commit is contained in:
Girish Ramakrishnan
2021-08-17 14:04:29 -07:00
parent 5bcf1bc47b
commit 5dd6f85025
10 changed files with 212 additions and 292 deletions

View File

@@ -41,7 +41,6 @@ const apps = require('./apps.js'),
constants = require('./constants.js'),
debug = require('debug')('box:docker'),
Docker = require('dockerode'),
os = require('os'),
path = require('path'),
reverseProxy = require('./reverseproxy.js'),
services = require('./services.js'),
@@ -228,7 +227,7 @@ function getAddonMounts(app, callback) {
const addons = app.manifest.addons;
if (!addons) return callback(null, mounts);
async.eachSeries(Object.keys(addons), function (addon, iteratorDone) {
async.eachSeries(Object.keys(addons), async function (addon) {
switch (addon) {
case 'localstorage':
mounts.push({
@@ -238,31 +237,28 @@ function getAddonMounts(app, callback) {
ReadOnly: false
});
return iteratorDone();
case 'tls':
reverseProxy.getCertificatePath(app.fqdn, app.domain, function (error, bundle) {
if (error) return iteratorDone(error);
return;
case 'tls': {
const bundle = await reverseProxy.getCertificatePath(app.fqdn, app.domain);
mounts.push({
Target: '/etc/certs/tls_cert.pem',
Source: bundle.certFilePath,
Type: 'bind',
ReadOnly: true
});
mounts.push({
Target: '/etc/certs/tls_cert.pem',
Source: bundle.certFilePath,
Type: 'bind',
ReadOnly: true
});
mounts.push({
Target: '/etc/certs/tls_key.pem',
Source: bundle.keyFilePath,
Type: 'bind',
ReadOnly: true
});
iteratorDone();
mounts.push({
Target: '/etc/certs/tls_key.pem',
Source: bundle.keyFilePath,
Type: 'bind',
ReadOnly: true
});
return;
}
default:
iteratorDone();
return;
}
}, function (error) {
callback(error, mounts);