Skip to content

Commit

Permalink
Added AGENT_APPLICATION_NAME similar to the controller name
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmcmaster committed Sep 29, 2023
1 parent cd9b887 commit 2937b26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions common/src/util/sqs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { AGENT_ENV, SYSTEM_NAME, getPrefix } from "./util";
import {
AGENT_APPLICATION_NAME,
AGENT_ENV,
SYSTEM_NAME,
getPrefix
} from "./util";
import {
ChangeMessageVisibilityCommand,
ChangeMessageVisibilityCommandInput,
Expand Down Expand Up @@ -43,7 +48,7 @@ export function init () {
// Controller should have this env variable from the deployment
const systemNames: string[] = AGENT_ENV.split(",");
for (const systemName of systemNames) {
const PREFIX: string = "PEWPEWAGENT_" + systemName.toUpperCase().replace("-", "_");
const PREFIX: string = (AGENT_APPLICATION_NAME + "_" + systemName).toUpperCase().replace("-", "_");
const queueUrlTest: string | undefined = process.env[`${PREFIX}_SQS_SCALE_OUT_QUEUE_URL`];
log(`${PREFIX}_SQS_SCALE_OUT_QUEUE_URL = ${queueUrlTest}`, LogLevel.DEBUG);
if (!queueUrlTest) {
Expand Down Expand Up @@ -72,7 +77,7 @@ export function init () {
// Controller should have this env variable from the deployment
const systemNames: string[] = AGENT_ENV.split(",");
for (const systemName of systemNames) {
const PREFIX: string = "PEWPEWAGENT_" + systemName.toUpperCase().replace("-", "_");
const PREFIX: string = (AGENT_APPLICATION_NAME + "_" + systemName).toUpperCase().replace("-", "_");
const queueUrlTest: string | undefined = process.env[`${PREFIX}_SQS_SCALE_IN_QUEUE_URL`];
log(`${PREFIX}_SQS_SCALE_IN_QUEUE_URL = ${queueUrlTest}`, LogLevel.DEBUG);
if (!queueUrlTest) {
Expand Down
1 change: 1 addition & 0 deletions common/src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { LogLevel, log } from "./log";

export const APPLICATION_NAME: string = process.env.APPLICATION_NAME || "pewpewagent";
export const CONTROLLER_APPLICATION_NAME: string = process.env.CONTROLLER_APPLICATION_NAME || "pewpewcontroller";
export const AGENT_APPLICATION_NAME: string = process.env.AGENT_APPLICATION_NAME || "pewpewagent";
export const CONTROLLER_APPLICATION_PREFIX: string = CONTROLLER_APPLICATION_NAME.toUpperCase().replace(/-/g, "_") + "_";
export const SYSTEM_NAME: string = process.env.SYSTEM_NAME || "unittests";
export const CONTROLLER_ENV = process.env.CONTROLLER_ENV;
Expand Down

0 comments on commit 2937b26

Please sign in to comment.