fix: when set USE_LOCAL=true get undefined endpoint error in server

This commit is contained in:
prafull-opensignlabs
2024-07-18 17:20:59 +05:30
parent 1eafc113e6
commit 9cfffe3fbd
3 changed files with 12 additions and 16 deletions
File diff suppressed because one or more lines are too long
@@ -62,7 +62,7 @@ const Sidebar = ({ isOpen, closeSidebar }) => {
}
];
} else {
const arr = newItem.children.slice(1, 2);
const arr = newItem.children.slice(0, 1);
newItem.children = [
...arr,
{
@@ -1,15 +1,15 @@
import AWS from 'aws-sdk';
import { useLocal } from '../../Utils.js';
const credentials = {
accessKeyId: process.env.DO_ACCESS_KEY_ID,
secretAccessKey: process.env.DO_SECRET_ACCESS_KEY,
};
AWS.config.update({ credentials: credentials, region: process.env.DO_REGION });
const spacesEndpoint = new AWS.Endpoint(process.env.DO_ENDPOINT);
const s3 = new AWS.S3({ endpoint: spacesEndpoint });
export default function getPresignedUrl(url) {
const credentials = {
accessKeyId: process.env.DO_ACCESS_KEY_ID,
secretAccessKey: process.env.DO_SECRET_ACCESS_KEY,
};
AWS.config.update({ credentials: credentials, region: process.env.DO_REGION });
const spacesEndpoint = new AWS.Endpoint(process.env.DO_ENDPOINT);
const s3 = new AWS.S3({ endpoint: spacesEndpoint });
// Create a new URL object
const parsedUrl = new URL(url);
// Get the pathname of the URL