Skip to content

Commit

Permalink
Merge pull request #98 from AshanFernando/master
Browse files Browse the repository at this point in the history
Custom Authorization function is initialized with endpoint env-variables
  • Loading branch information
dherault authored Sep 12, 2016
2 parents c6ceff5 + 41883e5 commit 028bd7c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/createAuthScheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ module.exports = function createAuthScheme(authFun, funName, endpointPath, optio
methodArn: `arn:aws:execute-api:${options.region}:<Account id>:<API id>/${options.stage}/${funName}/${endpointPath}`,
};

// Set environment variables
const newEnvVars = toPlainOrEmptyObject(populatedAuthFun.environment);
resetEnvVariables(this.envVars, newEnvVars);
this.envVars = newEnvVars;

// Create the Authorization function handler
let handler;

Expand Down Expand Up @@ -103,9 +108,6 @@ module.exports = function createAuthScheme(authFun, funName, endpointPath, optio
}
});

// Set environment variables
resetEnvVariables({}, toPlainOrEmptyObject(populatedAuthFun.environment));

// Execute the Authorization Function
handler(event, lambdaContext, lambdaContext.done);
},
Expand Down

0 comments on commit 028bd7c

Please sign in to comment.