Skip to content

Commit

Permalink
feat: init db wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
alinarublea committed Oct 19, 2023
1 parent c15a214 commit a4a362d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/db-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ import serviceWrap from './service-wrap.js';
export default function dynamoDBWrapper(func) {
return async (...args) => {
let params = {};
let context;
let context = {};
[params, context = {}] = args;
const region = process.env.AWS_REGION;
const region = context.env.AWS_REGION;
if (!region) {
throw Error('Please define region in secrets');
}
context = { ...context, region };
serviceWrap(
params,
context,
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function run(request, context) {

export const main = wrap(run)
.with(helixStatus)
.with(dynamoDBWrapper)
.with(logger.trace)
.with(logger)
.with(secrets);
.with(secrets)
.with(dynamoDBWrapper);

0 comments on commit a4a362d

Please sign in to comment.