improved env config
This commit is contained in:
@@ -33,7 +33,7 @@ export default async function getLink(userId: number, body: string) {
|
||||
};
|
||||
|
||||
const links = await prisma.link.findMany({
|
||||
take: Number(process.env.PAGINATION_TAKE_COUNT),
|
||||
take: Number(process.env.PAGINATION_TAKE_COUNT) || 20,
|
||||
skip: query.cursor ? 1 : undefined,
|
||||
cursor: query.cursor
|
||||
? {
|
||||
|
||||
@@ -16,7 +16,7 @@ export default async function getCollection(body: string) {
|
||||
|
||||
if (collection) {
|
||||
const links = await prisma.link.findMany({
|
||||
take: Number(process.env.PAGINATION_TAKE_COUNT),
|
||||
take: Number(process.env.PAGINATION_TAKE_COUNT) || 20,
|
||||
skip: query.cursor ? 1 : undefined,
|
||||
cursor: query.cursor
|
||||
? {
|
||||
|
||||
@@ -28,7 +28,7 @@ export default async function createFile({
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
const storagePath = process.env.STORAGE_FOLDER;
|
||||
const storagePath = process.env.STORAGE_FOLDER || "data";
|
||||
const creationPath = path.join(process.cwd(), storagePath + "/" + filePath);
|
||||
|
||||
fs.writeFile(creationPath, data, isBase64 ? "base64" : {}, function (err) {
|
||||
|
||||
@@ -6,7 +6,7 @@ export default function createFolder({ filePath }: { filePath: string }) {
|
||||
if (s3Client) {
|
||||
// Do nothing, S3 creates directories recursively
|
||||
} else {
|
||||
const storagePath = process.env.STORAGE_FOLDER;
|
||||
const storagePath = process.env.STORAGE_FOLDER || "data";
|
||||
const creationPath = path.join(process.cwd(), storagePath + "/" + filePath);
|
||||
|
||||
fs.mkdirSync(creationPath, { recursive: true });
|
||||
|
||||
@@ -41,7 +41,7 @@ export default async function readFile({ filePath }: { filePath: string }) {
|
||||
};
|
||||
}
|
||||
} else {
|
||||
const storagePath = process.env.STORAGE_FOLDER;
|
||||
const storagePath = process.env.STORAGE_FOLDER || "data";
|
||||
const creationPath = path.join(process.cwd(), storagePath + "/" + filePath);
|
||||
|
||||
const file = fs.existsSync(creationPath)
|
||||
|
||||
@@ -16,7 +16,7 @@ export default async function removeFile({ filePath }: { filePath: string }) {
|
||||
console.log("Error", err);
|
||||
}
|
||||
} else {
|
||||
const storagePath = process.env.STORAGE_FOLDER;
|
||||
const storagePath = process.env.STORAGE_FOLDER || "data";
|
||||
const creationPath = path.join(process.cwd(), storagePath + "/" + filePath);
|
||||
|
||||
fs.unlink(creationPath, (err) => {
|
||||
|
||||
@@ -45,7 +45,7 @@ export default async function removeFolder({ filePath }: { filePath: string }) {
|
||||
console.log("Error", err);
|
||||
}
|
||||
} else {
|
||||
const storagePath = process.env.STORAGE_FOLDER;
|
||||
const storagePath = process.env.STORAGE_FOLDER || "data";
|
||||
const creationPath = path.join(process.cwd(), storagePath + "/" + filePath);
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user