generated from nhcarrigan/template
feat: make endpoint an env instead of hardcoded
CI / dependency-pin-check-typescript (pull_request) Successful in 4s
CI / dependency-pin-check-python (pull_request) Successful in 4s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 54s
CI / python (pull_request) Successful in 9m25s
CI / typescript (pull_request) Successful in 9m43s
CI / dependency-pin-check-typescript (pull_request) Successful in 4s
CI / dependency-pin-check-python (pull_request) Successful in 4s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 54s
CI / python (pull_request) Successful in 9m25s
CI / typescript (pull_request) Successful in 9m43s
This commit is contained in:
@@ -12,11 +12,16 @@ import { getMimeType } from "../utils/mimeType.js";
|
||||
|
||||
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
||||
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
||||
const endpoint = process.env.S3_ENDPOINT;
|
||||
|
||||
if (accessKeyId === undefined || secretAccessKey === undefined) {
|
||||
throw new Error("AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY is not set");
|
||||
}
|
||||
|
||||
if (endpoint === undefined) {
|
||||
throw new Error("S3_ENDPOINT is not set");
|
||||
}
|
||||
|
||||
const dataDirectory = join(import.meta.dirname, "..", "..", "data");
|
||||
|
||||
/**
|
||||
@@ -172,7 +177,7 @@ if (!shouldProceed) {
|
||||
|
||||
const s3 = new S3Client({
|
||||
credentials: { accessKeyId, secretAccessKey },
|
||||
endpoint: "https://hel1.your-objectstorage.com",
|
||||
endpoint: endpoint,
|
||||
region: "hel1",
|
||||
});
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import { getMimeType } from "../utils/mimeType.js";
|
||||
|
||||
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
||||
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
||||
const endpoint = process.env.S3_ENDPOINT;
|
||||
|
||||
if (accessKeyId === undefined || secretAccessKey === undefined) {
|
||||
throw new Error(
|
||||
@@ -22,9 +23,13 @@ if (accessKeyId === undefined || secretAccessKey === undefined) {
|
||||
);
|
||||
}
|
||||
|
||||
if (endpoint === undefined) {
|
||||
throw new Error("S3_ENDPOINT is not set");
|
||||
}
|
||||
|
||||
const s3 = new S3Client({
|
||||
credentials: { accessKeyId, secretAccessKey },
|
||||
endpoint: "https://hel1.your-objectstorage.com",
|
||||
endpoint: endpoint,
|
||||
region: "hel1",
|
||||
});
|
||||
|
||||
|
||||
@@ -12,11 +12,16 @@ import { SingleBar, Presets } from "cli-progress";
|
||||
|
||||
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
||||
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
||||
const endpoint = process.env.S3_ENDPOINT;
|
||||
|
||||
if (accessKeyId === undefined || secretAccessKey === undefined) {
|
||||
throw new Error("AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY is not set");
|
||||
}
|
||||
|
||||
if (endpoint === undefined) {
|
||||
throw new Error("S3_ENDPOINT is not set");
|
||||
}
|
||||
|
||||
// Get bucket name
|
||||
const bucketName = await input({
|
||||
message: "Enter the S3 bucket name:",
|
||||
@@ -35,7 +40,7 @@ const bucketName = await input({
|
||||
// Create S3 client
|
||||
const s3 = new S3Client({
|
||||
credentials: { accessKeyId, secretAccessKey },
|
||||
endpoint: "https://hel1.your-objectstorage.com",
|
||||
endpoint: endpoint,
|
||||
region: "hel1",
|
||||
});
|
||||
|
||||
|
||||
@@ -11,11 +11,16 @@ import { getMimeType } from "../utils/mimeType.js";
|
||||
|
||||
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
||||
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
||||
const endpoint = process.env.S3_ENDPOINT;
|
||||
|
||||
if (accessKeyId === undefined || secretAccessKey === undefined) {
|
||||
throw new Error("AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY is not set");
|
||||
}
|
||||
|
||||
if (endpoint === undefined) {
|
||||
throw new Error("S3_ENDPOINT is not set");
|
||||
}
|
||||
|
||||
const fileName = await input({
|
||||
message:
|
||||
// eslint-disable-next-line stylistic/max-len -- Big boi string.
|
||||
@@ -40,7 +45,7 @@ if (uploadPath === "") {
|
||||
|
||||
const s3 = new S3Client({
|
||||
credentials: { accessKeyId, secretAccessKey },
|
||||
endpoint: "https://hel1.your-objectstorage.com",
|
||||
endpoint: endpoint,
|
||||
region: "hel1",
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user