From 5b5abe99e738f066594ff4635006187efce99e34 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Wed, 28 Oct 2015 12:24:59 +0100 Subject: [PATCH] Save the uploaded certs to app cert directory --- src/apps.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/apps.js b/src/apps.js index b995521cf..c4d720c0e 100644 --- a/src/apps.js +++ b/src/apps.js @@ -387,6 +387,12 @@ function configure(appId, location, portBindings, accessRestriction, oauthProxy, error = validatePortBindings(portBindings, app.manifest.tcpPorts); if (error) return callback(new AppsError(AppsError.BAD_FIELD, error.message)); + // save cert to data/box/certs + if (cert && key) { + if (!safe.fs.writeFileSync(path.join(paths.APP_CERT_DIR, location + '.crt'), cert)) return callback(new AppsError(AppsError.INTERNAL_ERROR, 'Error saving cert: ' + safe.error.message)); + if (!safe.fs.writeFileSync(path.join(paths.APP_CERT_DIR, location + '.key'), key)) return callback(new AppsError(AppsError.INTERNAL_ERROR, 'Error saving key: ' + safe.error.message)); + } + var values = { location: location.toLowerCase(), accessRestriction: accessRestriction,