Skip to content

Commit 12dccfd

Browse files
datadump refactor
1 parent b4d0051 commit 12dccfd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tools/spectral/ipa/metrics/dataDump.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PutObjectCommand, S3Client, S3ServiceException } from '@aws-sdk/client-
66
import config from './config.js';
77
import path from 'path';
88

9-
function loadConfig() {
9+
function loadS3Config() {
1010
if (existsSync('.env') && !process.env.S3_BUCKET_PREFIX) {
1111
dotenv.config();
1212
}
@@ -23,16 +23,16 @@ function loadConfig() {
2323
}
2424

2525
export function getS3FilePath() {
26-
const AWSConfig = loadConfig();
26+
const S3Config = loadS3Config();
2727

28-
const pathParts = AWSConfig.s3.prefix.replace('s3://', '').split('/');
28+
const pathParts = S3Config.s3.prefix.replace('s3://', '').split('/');
2929
const bucketName = pathParts[0];
3030
let key = pathParts.slice(1).join('/');
3131
return { bucketName, key };
3232
}
3333

3434
export function getS3Client() {
35-
const AWSConfig = loadConfig();
35+
const AWSConfig = loadS3Config();
3636

3737
return new S3Client({
3838
credentials: {
@@ -51,10 +51,10 @@ export async function uploadMetricCollectionDataToS3(filePath = config.defaultMe
5151
const client = getS3Client();
5252
const formattedDate = new Date().toISOString().split('T')[0];
5353

54-
const fileProps = getS3FilePath();
54+
const s3fileProps = getS3FilePath();
5555
const command = new PutObjectCommand({
56-
Bucket: fileProps.bucketName,
57-
Key: path.join(fileProps.key, formattedDate, 'metric-collection-results.json'),
56+
Bucket: s3fileProps.bucketName,
57+
Key: path.join(s3fileProps.key, formattedDate, 'metric-collection-results.json'),
5858
Body: await readFile(filePath),
5959
});
6060

0 commit comments

Comments
 (0)