Initial setup: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== set initail setup == * set dynamodb table <syntaxhighlight lang="JavaScript"> module.exports.tableConfigs = { Config: { // serviceName: serviceNameRbac, //tableName: 'UserRoles', // can overwrite tableName here }, ProductRecord: { // serviceName: initialSetupConfig.serviceNameProductManager, }, RolePermissions: { serviceName: initialSetupConfig.serviceNameRbac, }, //... } </syntaxhighlight> * set subscription topic <syntaxhighlight lan...") |
(No difference)
|
Latest revision as of 01:27, 19 October 2023
set initail setup
- set dynamodb table
module.exports.tableConfigs = {
Config: {
// serviceName: serviceNameRbac,
//tableName: 'UserRoles', // can overwrite tableName here
},
ProductRecord: {
// serviceName: initialSetupConfig.serviceNameProductManager,
},
RolePermissions: {
serviceName: initialSetupConfig.serviceNameRbac,
},
//...
}
- set subscription topic
/** service name for create subscription topic */
module.exports.snsTopicSubscriptions = [
{
serviceName: initialSetupConfig.serviceNameProductManager,
topicName: "OutServiceComplete",
sqsEndpoint: "ProcessProduct"
},
//...
];
- set seed data for dynamodb
module.exports.seedDynamodbConfig = () => {
let seedDataGroup = [
{
configKey: "ProductGraphServiceName",
configTag: "ProductGraphServiceName",
configValue: "ProductGraph"
},
{
configKey: "ProductHandlerServiceNameTag",
configTag: "ProductHandlerServiceNameTag",
configValue: {
serviceName: "ProductStandard"
}
}
]
return seedDataGroup;
}
- set IAM role for external lambda
/** IAM role for external lambda */
module.exports.lambdaRoleConfigs = () => {
//* add more role for external service action, if have
{
functionName: 'CreateProductApi', // roleName exceed 64
statement: [
{
// "Sid": "GenerateSeedGraphTestEnvInvokeStatement",
"Effect": "Allow",
"Action": [
'SNS:Publish'
],
"Resource": [
//other
],
},
]
},
}
- add role if want to testing integrationtest
// // // ------add role if want to testing integrationtest
// // // NOTE: dont remember to add varible: resourcePrefixIntTest
if (initialSetupConfig.resourcePrefixIntTest) {
const functionsToAddPermission = [
"CreateProductApi",
// "anotherLambda",
];
for (const functionToAddPermission of functionsToAddPermission) {
let roleForIntTest = {
functionName: functionToAddPermission,
statement: [
{
"Sid": functionToAddPermission + "SnsStatement",
"Effect": "Allow",
"Action": [
'SNS:Publish'
],
"Resource": [
snsSharedLib.snsTopicArn("InIntTestInput", initialSetupConfig.resourcePrefixIntTest),
snsSharedLib.snsTopicArn("InIntTestOutput", initialSetupConfig.resourcePrefixIntTest),
snsSharedLib.snsTopicArn("InIntTestInvInput", initialSetupConfig.resourcePrefixIntTest),
snsSharedLib.snsTopicArn("InIntTestInvOutput", initialSetupConfig.resourcePrefixIntTest),],
},
]
}
// if (roleForIntTest.functionName == )
returnArray.push(roleForIntTest)
}
}