Merge pull request #284 from BTLzdravtech/dev

feat: Basic support for Keycloak (OIDC) + fix s3 integration + custom s3 (minio) support
This commit is contained in:
Daniel
2023-11-19 16:55:09 +03:30
committed by GitHub
14 changed files with 132 additions and 17 deletions
@@ -22,7 +22,7 @@ export default async function deleteUserById(
}
// Then, we check if the provided password matches the one stored in the database
const isPasswordValid = bcrypt.compareSync(body.password, user.password);
const isPasswordValid = bcrypt.compareSync(body.password, user.password || "");
if (!isPasswordValid) {
return {
+1 -1
View File
@@ -14,7 +14,7 @@ export default async function createFile({
}) {
if (s3Client) {
const bucketParams: PutObjectCommandInput = {
Bucket: process.env.BUCKET_NAME,
Bucket: process.env.SPACES_BUCKET_NAME,
Key: filePath,
Body: isBase64 ? Buffer.from(data as string, "base64") : data,
};
+1 -1
View File
@@ -5,7 +5,7 @@ import removeFile from "./removeFile";
export default async function moveFile(from: string, to: string) {
if (s3Client) {
const Bucket = process.env.BUCKET_NAME;
const Bucket = process.env.SPACES_BUCKET_NAME;
const copyParams = {
Bucket: Bucket,
+1 -1
View File
@@ -20,7 +20,7 @@ export default async function readFile(filePath: string) {
if (s3Client) {
const bucketParams: GetObjectCommandInput = {
Bucket: process.env.BUCKET_NAME,
Bucket: process.env.SPACES_BUCKET_NAME,
Key: filePath,
};
+1 -1
View File
@@ -6,7 +6,7 @@ import { PutObjectCommandInput, DeleteObjectCommand } from "@aws-sdk/client-s3";
export default async function removeFile({ filePath }: { filePath: string }) {
if (s3Client) {
const bucketParams: PutObjectCommandInput = {
Bucket: process.env.BUCKET_NAME,
Bucket: process.env.SPACES_BUCKET_NAME,
Key: filePath,
};
+1 -1
View File
@@ -40,7 +40,7 @@ async function emptyS3Directory(bucket: string, dir: string) {
export default async function removeFolder({ filePath }: { filePath: string }) {
if (s3Client) {
try {
await emptyS3Directory(process.env.BUCKET_NAME as string, filePath);
await emptyS3Directory(process.env.SPACES_BUCKET_NAME as string, filePath);
} catch (err) {
console.log("Error", err);
}
+1 -1
View File
@@ -6,7 +6,7 @@ const s3Client: S3 | undefined =
process.env.SPACES_KEY &&
process.env.SPACES_SECRET
? new S3({
forcePathStyle: false,
forcePathStyle: !!process.env.SPACES_FORCE_PATH_STYLE,
endpoint: process.env.SPACES_ENDPOINT,
region: process.env.SPACES_REGION,
credentials: {