dokku-compose 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +13 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -156,12 +156,10 @@ function createRunner(opts = {}) {
156
156
  await execDokku(args);
157
157
  },
158
158
  async query(...args) {
159
- if (opts.dryRun) return "";
160
159
  const { stdout } = await execDokku(args);
161
160
  return stdout.trim();
162
161
  },
163
162
  async check(...args) {
164
- if (opts.dryRun) return false;
165
163
  const { ok } = await execDokku(args);
166
164
  return ok;
167
165
  },
@@ -1131,6 +1129,14 @@ function validate(filePath) {
1131
1129
  return { errors, warnings };
1132
1130
  }
1133
1131
 
1132
+ // src/core/mask.ts
1133
+ function maskSensitiveArgs(cmd) {
1134
+ return cmd.replace(/([^\s=]*(?:TOKEN|SECRET|PASSWORD|KEY|AUTH|CREDENTIAL)[^\s=]*)=(\S+)/gi, (_, key, value) => {
1135
+ if (value.length <= 4) return `${key}=****`;
1136
+ return `${key}=****${value.slice(-4)}`;
1137
+ });
1138
+ }
1139
+
1134
1140
  // src/index.ts
1135
1141
  var require2 = createRequire(import.meta.url);
1136
1142
  var { version } = require2("../package.json");
@@ -1141,7 +1147,7 @@ function makeRunner(opts) {
1141
1147
  dryRun: opts.dryRun ?? false
1142
1148
  });
1143
1149
  }
1144
- program.command("up [apps...]").description("Create/update apps and services to match config").option("-f, --file <path>", "Config file", "dokku-compose.yml").option("--dry-run", "Print commands without executing").option("--fail-fast", "Stop on first error").action(async (apps, opts) => {
1150
+ program.command("up [apps...]").description("Create/update apps and services to match config").option("-f, --file <path>", "Config file", "dokku-compose.yml").option("--dry-run", "Print commands without executing").option("--sensitive", "Show sensitive values in dry-run output (masked by default)").option("--fail-fast", "Stop on first error").action(async (apps, opts) => {
1145
1151
  const config = loadConfig(opts.file);
1146
1152
  const runner = makeRunner(opts);
1147
1153
  const ctx = createContext(runner);
@@ -1149,7 +1155,10 @@ program.command("up [apps...]").description("Create/update apps and services to
1149
1155
  await runUp(ctx, config, apps);
1150
1156
  if (opts.dryRun) {
1151
1157
  console.log("\n# Commands that would run:");
1152
- for (const cmd of runner.dryRunLog) console.log(`dokku ${cmd}`);
1158
+ for (const cmd of runner.dryRunLog) {
1159
+ const line = opts.sensitive ? cmd : maskSensitiveArgs(cmd);
1160
+ console.log(`dokku ${line}`);
1161
+ }
1153
1162
  }
1154
1163
  } finally {
1155
1164
  await ctx.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dokku-compose",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Docker Compose for Dokku — declare your entire server in a single YAML file.",
5
5
  "main": "dist/index.js",
6
6
  "exports": "./dist/index.js",