replace usage of _.extend with Object.assign

This commit is contained in:
Girish Ramakrishnan
2023-05-25 11:27:23 +02:00
parent 79dd50910c
commit e6ba2a6e7a
15 changed files with 62 additions and 71 deletions

View File

@@ -46,8 +46,7 @@ const apps = require('./apps.js'),
safe = require('safetydance'),
system = require('./system.js'),
timers = require('timers/promises'),
volumes = require('./volumes.js'),
_ = require('underscore');
volumes = require('./volumes.js');
const DOCKER_SOCKET_PATH = '/var/run/docker.sock';
const gConnection = new Docker({ socketPath: DOCKER_SOCKET_PATH });
@@ -318,7 +317,7 @@ async function createSubcontainer(app, name, cmd, options) {
app.manifest.runtimeDirs.forEach(dir => runtimeVolumes[dir] = {});
}
let containerOptions = {
const containerOptions = {
name: name, // for referencing containers
Tty: isAppContainer,
Image: app.manifest.dockerImage,
@@ -405,9 +404,9 @@ async function createSubcontainer(app, name, cmd, options) {
];
}
containerOptions = _.extend(containerOptions, options);
const mergedOptions = Object.assign({}, containerOptions, options);
const [createError, container] = await safe(gConnection.createContainer(containerOptions));
const [createError, container] = await safe(gConnection.createContainer(mergedOptions));
if (createError && createError.statusCode === 409) throw new BoxError(BoxError.ALREADY_EXISTS, createError);
if (createError) throw new BoxError(BoxError.DOCKER_ERROR, createError);