shell: make require take a tag

This commit is contained in:
Girish Ramakrishnan
2024-10-14 19:10:31 +02:00
parent 02823c4158
commit a9e1d7641d
27 changed files with 162 additions and 156 deletions
+3 -3
View File
@@ -20,7 +20,7 @@ const apps = require('./apps.js'),
paths = require('./paths.js'),
safe = require('safetydance'),
services = require('./services.js'),
shell = require('./shell.js'),
shell = require('./shell.js')('sftp'),
volumes = require('./volumes.js');
async function ensureKeys() {
@@ -34,7 +34,7 @@ async function ensureKeys() {
debug(`ensureSecrets: generating new sftp keys of type ${keyType}`);
safe.fs.unlinkSync(publicKeyFile);
safe.fs.unlinkSync(privateKeyFile);
const [error] = await safe(shell.exec('ensureKeys', `ssh-keygen -m PEM -t ${keyType} -f ${paths.SFTP_KEYS_DIR}/ssh_host_${keyType}_key -q -N ""`, { shell: '/bin/bash' }));
const [error] = await safe(shell.exec(`ssh-keygen -m PEM -t ${keyType} -f ${paths.SFTP_KEYS_DIR}/ssh_host_${keyType}_key -q -N ""`, { shell: '/bin/bash' }));
if (error) throw new BoxError(BoxError.OPENSSL_ERROR, `Could not generate sftp ${keyType} keys: ${error.message}`);
const newPublicKey = safe.fs.readFileSync(publicKeyFile);
await blobs.set(`sftp_${keyType}_public_key`, newPublicKey);
@@ -124,7 +124,7 @@ async function start(existingInfra) {
await docker.deleteContainer('sftp');
debug('startSftp: starting sftp container');
await shell.exec('startSftp', runCmd, { shell: '/bin/bash' });
await shell.exec(runCmd, { shell: '/bin/bash' });
}
async function status() {