Add Dockerfile, add raw view
This commit is contained in:
10
src/lib/prisma.ts
Normal file
10
src/lib/prisma.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import "dotenv/config";
|
||||
import { PrismaClient } from '../generated/prisma/client';
|
||||
|
||||
const connectionString = `${process.env.DATABASE_URL}`
|
||||
|
||||
const adapter = new PrismaPg({ connectionString })
|
||||
const prisma = new PrismaClient({ adapter })
|
||||
|
||||
export { prisma };
|
||||
22
src/lib/s3.ts
Normal file
22
src/lib/s3.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
||||
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
||||
import "dotenv/config";
|
||||
|
||||
export const s3 = new S3Client({
|
||||
region: "us-east-1",
|
||||
endpoint: `${process.env.S3_ENDPOINT}`,
|
||||
forcePathStyle: true,
|
||||
credentials: {
|
||||
accessKeyId: `${process.env.S3_ACCESSKEY}`,
|
||||
secretAccessKey: `${process.env.S3_SECRET}`,
|
||||
},
|
||||
});
|
||||
|
||||
export async function getSignedImageUrl(key: string, expiresInSec = 3600) {
|
||||
const command = new GetObjectCommand({
|
||||
Bucket: `${process.env.BUCKET_NAME}`,
|
||||
Key: key,
|
||||
});
|
||||
|
||||
return getSignedUrl(s3, command, { expiresIn: expiresInSec });
|
||||
}
|
||||
6
src/lib/utils.ts
Normal file
6
src/lib/utils.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
Reference in New Issue
Block a user