I am C# guy but I am writing first time node JS lambda function. I am trying to return JSON object the based on environment for example if query param ?env=prod
then expected response will be
{
"Aws_Client_Id": "ProdAbc",
"Aws_Secret_Key": "ProdAbc",
"FeatureStringTest": "DefaultValue"
}
config.json
{
"Aws_Client_Id": {
"Deafult": "Abc",
"Dev": "DevAbc",
"Uat": "UatAbc",
"Prod": "ProdAbc"
},
"Aws_Secret_Key": {
"Deafult": "Abc",
"Dev": "DevAbc",
"Uat": "UatAbc",
"Prod": "ProdAbc"
},
"FeatureStringTest": "DefaultValue"
}
my current lambda code
const fs = require("fs");
exports.handler = async (event) => {
const jsonString = fs.readFileSync("./config.json", 'utf8');
var config = JSON.parse(jsonString);
const response = {
statusCode: 200,
body: JSON.stringify(config),
};
return response;
};