app import: restore icon, tag, label, proxy configs etc
This commit is contained in:
+18
-1
@@ -71,6 +71,7 @@ exports = module.exports = {
|
||||
uploadFile,
|
||||
|
||||
backupConfig,
|
||||
restoreConfig,
|
||||
|
||||
PORT_TYPE_TCP: 'tcp',
|
||||
PORT_TYPE_UDP: 'udp',
|
||||
@@ -1695,7 +1696,7 @@ function clone(app, data, user, auditSource, callback) {
|
||||
label: app.label ? `${app.label}-clone` : '',
|
||||
tags: app.tags,
|
||||
enableAutomaticUpdate: app.enableAutomaticUpdate,
|
||||
icons: icons.icon
|
||||
icon: icons.icon
|
||||
};
|
||||
|
||||
appdb.add(newAppId, appStoreId, manifest, location, domain, translatePortBindings(portBindings, manifest), data, function (error) {
|
||||
@@ -2217,3 +2218,19 @@ function backupConfig(app, callback) {
|
||||
callback(null);
|
||||
});
|
||||
}
|
||||
|
||||
function restoreConfig(app, callback) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
const appConfig = safe.JSON.parse(safe.fs.readFileSync(path.join(paths.APPS_DATA_DIR, app.id + '/config.json')));
|
||||
let data = {};
|
||||
if (appConfig) {
|
||||
data = _.pick(appConfig, 'memoryLimit', 'cpuShares', 'enableBackup', 'reverseProxyConfig', 'env', 'servicesConfig', 'label', 'tags', 'enableAutomaticUpdate');
|
||||
}
|
||||
|
||||
const icon = safe.fs.readFileSync(path.join(paths.APPS_DATA_DIR, app.id + '/icon.png'));
|
||||
if (icon) data.icon = icon;
|
||||
|
||||
appdb.update(app.id, data, callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user