Skip to content

Commit

Permalink
fix: check process.argv length before determining app name
Browse files Browse the repository at this point in the history
prevent a probloem like in abreits#20 and a fix similar to abreits/amqp-ts/#62
  • Loading branch information
Kampfmoehre committed Mar 3, 2021
1 parent 413c97b commit f7d0a18
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/amqp-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@

import * as path from "path";

/** Name of the current application determined by AMQP_APPLICATIONNAME env or the name of the dir we're running in. */
export const ApplicationName =
process.env.AMQPTS_APPLICATIONNAME ||
(path.parse ? path.parse(process.argv[1]).name : path.basename(process.argv[1]));

process.env.AMQP_APPLICATIONNAME ||
(process.argv.length > 1
? path.parse
? path.parse(process.argv[1]).name
: path.basename(process.argv[1])
: "amqpApp");

// name for the RabbitMQ direct reply-to queue
export const DIRECT_REPLY_TO_QUEUE = "amq.rabbitmq.reply-to";

0 comments on commit f7d0a18

Please sign in to comment.