Skip to content

Commit

Permalink
feat(config): expose util for standard queue url per async task
Browse files Browse the repository at this point in the history
  • Loading branch information
uladkasach committed Dec 26, 2024
1 parent ab0f1d8 commit 2b54138
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { paramCase } from 'change-case';
import { DomainObject } from 'domain-objects';
import type { AsyncTask } from 'simple-async-tasks';

import { getConfig } from './getConfig';

export type ClassOf<T> = new (...args: any[]) => T;

export const getQueueUrlForTask = async (
task: ClassOf<DomainObject<AsyncTask>>,
) => {
const config = await getConfig();
const taskName = task.name;
return [
'https://sqs.us-east-1.amazonaws.com',
`/${config.aws.account}/`,
`${config.project}-${config.environment.access}-${paramCase(taskName)}-llq`,
].join('');
};

0 comments on commit 2b54138

Please sign in to comment.