email plus return item statuses
This commit is contained in:
36
backend/config/aws.js
Normal file
36
backend/config/aws.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const { fromIni } = require("@aws-sdk/credential-providers");
|
||||
|
||||
/**
|
||||
* Get AWS configuration based on environment
|
||||
* - Development: Uses AWS credential profiles from ~/.aws/credentials
|
||||
* - Production: Uses IAM roles (EC2/Lambda/ECS instance roles)
|
||||
*/
|
||||
function getAWSCredentials() {
|
||||
if (process.env.NODE_ENV === "dev") {
|
||||
// Local development: use profile from ~/.aws/credentials
|
||||
const profile = process.env.AWS_PROFILE;
|
||||
return fromIni({ profile });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get complete AWS client configuration
|
||||
*/
|
||||
function getAWSConfig() {
|
||||
const config = {
|
||||
region: process.env.AWS_REGION || "us-east-1",
|
||||
};
|
||||
|
||||
const credentials = getAWSCredentials();
|
||||
|
||||
if (credentials) {
|
||||
config.credentials = credentials;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAWSConfig,
|
||||
getAWSCredentials,
|
||||
};
|
||||
Reference in New Issue
Block a user