@open-wa/wa-automate 4.31.4 → 4.31.5

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.
@@ -38,6 +38,11 @@ exports.optionList = [{
38
38
  typeLabel: '{blue {underline 8080}}',
39
39
  description: "Set the port for the api. Default to 8002."
40
40
  },
41
+ {
42
+ name: 'forcePort',
43
+ type: Number,
44
+ description: "Sometimes --port is overridden by environmental variables or the config file. Use this flag to force the port to be used."
45
+ },
41
46
  {
42
47
  name: 'api-host',
43
48
  type: String,
package/dist/cli/setup.js CHANGED
@@ -169,7 +169,7 @@ const cli = () => {
169
169
  if (Array.isArray(cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging))
170
170
  cliConfig.logging = (0, logging_1.setupLogging)(cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging, `easy-api-${(cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.sessionId) || 'session'}`);
171
171
  }
172
- const PORT = Number(cliConfig.port || process.env.PORT || 8080);
172
+ const PORT = Number((typeof cliConfig.forcePort === "boolean" && cliConfig.forcePort ? process.env.PORT : cliConfig.forcePort) || cliConfig.port || process.env.PORT || 8080);
173
173
  const spinner = new events_1.Spin(cliConfig.sessionId, 'STARTUP', cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.disableSpins);
174
174
  const createConfig = Object.assign({}, cliConfig);
175
175
  if (cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.session) {
@@ -238,7 +238,12 @@ const cli = () => {
238
238
  if (cliConfig.apiHost) {
239
239
  cliConfig.apiHost = cliConfig.apiHost.replace(/\/$/, '');
240
240
  }
241
+ /**
242
+ * Check the port in the config
243
+ */
244
+ cliConfig.port = PORT;
241
245
  if (cliConfig.debug) {
246
+ spinner.succeed(`DEBUG - PORT: ${PORT}`);
242
247
  spinner.succeed(`DEBUG - flags: ${JSON.stringify(cliConfig)}`);
243
248
  const WA_ENV = {};
244
249
  Object.keys(process.env).map(k => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.31.4",
3
+ "version": "4.31.5",
4
4
  "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",