From 4322a95d043ace70a86b00366f06a36fc596c3cd Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 12 Jan 2024 05:40:12 -0600 Subject: [PATCH] refactor: redact environment --- packages/docker/src/start-container.js | 15 ++++++++++++++- website/docs/database.mdx | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/docker/src/start-container.js b/packages/docker/src/start-container.js index 62bf37f..8f8bba5 100644 --- a/packages/docker/src/start-container.js +++ b/packages/docker/src/start-container.js @@ -59,7 +59,20 @@ export default async (flecks, key, config) => { } args.push('-v', `${datadir}:${config.mount}`); args.push(config.image); - debug('launching: docker %s', args.join(' ')); + debug( + 'launching: docker %s', + args.map((arg, i) => { + if (i > 0 && '-e' === args[i - 1]) { + const parts = arg.split('='); + if (parts.length > 1) { + parts[1] = '...'; + } + // eslint-disable-next-line no-param-reassign + arg = parts.join('='); + } + return arg; + }).join(' '), + ); const child = spawn('docker', args, { detached: true, stdio: 'ignore', diff --git a/website/docs/database.mdx b/website/docs/database.mdx index af5ab1a..cb753dc 100644 --- a/website/docs/database.mdx +++ b/website/docs/database.mdx @@ -432,7 +432,7 @@ logs: ``` @flecks/docker/container creating datadir '/tmp/flecks/flecks/docker/sequelize' +0ms - @flecks/docker/container launching: docker run --name flecks_sequelize -d --rm -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_DB=db -e POSTGRES_PASSWORD=THIS_PASSWORD_IS_UNSAFE -v /tmp/flecks/flecks/docker/sequelize:/var/lib/postgresql/data postgres +0ms + @flecks/docker/container launching: docker run --name flecks_sequelize -d --rm -p 5432:5432 -e POSTGRES_USER=... -e POSTGRES_DB=... -e POSTGRES_PASSWORD=... -v /tmp/flecks/flecks/docker/sequelize:/var/lib/postgresql/data postgres +0ms @flecks/docker/container 'sequelize' started +372ms @flecks/db/server/connection config: { database: 'db', dialect: 'postgres', host: undefined, password: '*** REDACTED ***', port: undefined, username: 'postgres' } +0ms @flecks/db/server/connection synchronizing... +2s