mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
feat: new unified data folder
This commit is contained in:
@ -2,6 +2,17 @@ import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
extends: ["./drop-base"],
|
||||
|
||||
// Module config from here down
|
||||
modules: [
|
||||
"vue3-carousel-nuxt",
|
||||
"nuxt-security",
|
||||
// "@nuxt/image",
|
||||
"@nuxt/fonts",
|
||||
"@nuxt/eslint",
|
||||
],
|
||||
|
||||
// Nuxt-only config
|
||||
telemetry: false,
|
||||
compatibilityDate: "2024-04-03",
|
||||
@ -21,6 +32,10 @@ export default defineNuxtConfig({
|
||||
viewTransition: true,
|
||||
},
|
||||
|
||||
// future: {
|
||||
// compatibilityVersion: 4,
|
||||
// },
|
||||
|
||||
vite: {
|
||||
plugins: [tailwindcss()],
|
||||
},
|
||||
@ -76,17 +91,6 @@ export default defineNuxtConfig({
|
||||
},
|
||||
},
|
||||
|
||||
extends: ["./drop-base"],
|
||||
|
||||
// Module config from here down
|
||||
modules: [
|
||||
"vue3-carousel-nuxt",
|
||||
"nuxt-security",
|
||||
// "@nuxt/image",
|
||||
"@nuxt/fonts",
|
||||
"@nuxt/eslint",
|
||||
],
|
||||
|
||||
carousel: {
|
||||
prefix: "Vue",
|
||||
},
|
||||
|
||||
@ -2,6 +2,7 @@ import path from "path";
|
||||
import fs from "fs";
|
||||
import type { CertificateBundle } from "./ca";
|
||||
import prisma from "../db/database";
|
||||
import { systemConfig } from "../config/sys-conf";
|
||||
|
||||
export type CertificateStore = {
|
||||
store(name: string, data: CertificateBundle): Promise<void>;
|
||||
@ -10,7 +11,8 @@ export type CertificateStore = {
|
||||
checkBlacklistCertificate(name: string): Promise<boolean>;
|
||||
};
|
||||
|
||||
export const fsCertificateStore = (base: string) => {
|
||||
export const fsCertificateStore = () => {
|
||||
const base = path.join(systemConfig.getDataFolder(), "certs");
|
||||
const blacklist = path.join(base, ".blacklist");
|
||||
fs.mkdirSync(blacklist, { recursive: true });
|
||||
const store: CertificateStore = {
|
||||
|
||||
14
server/internal/config/sys-conf.ts
Normal file
14
server/internal/config/sys-conf.ts
Normal file
@ -0,0 +1,14 @@
|
||||
class SystemConfig {
|
||||
private libraryFolder = process.env.LIBRARY ?? "./.data/library";
|
||||
private dataFolder = process.env.DATA ?? "./.data/data";
|
||||
|
||||
getLibraryFolder() {
|
||||
return this.libraryFolder;
|
||||
}
|
||||
|
||||
getDataFolder() {
|
||||
return this.dataFolder;
|
||||
}
|
||||
}
|
||||
|
||||
export const systemConfig = new SystemConfig();
|
||||
@ -15,12 +15,13 @@ import taskHandler from "../tasks";
|
||||
import { parsePlatform } from "../utils/parseplatform";
|
||||
import droplet from "@drop-oss/droplet";
|
||||
import notificationSystem from "../notifications";
|
||||
import { systemConfig } from "../config/sys-conf";
|
||||
|
||||
class LibraryManager {
|
||||
private basePath: string;
|
||||
|
||||
constructor() {
|
||||
this.basePath = process.env.LIBRARY ?? "./.data/library";
|
||||
this.basePath = systemConfig.getLibraryFolder();
|
||||
fs.mkdirSync(this.basePath, { recursive: true });
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import { Readable } from "stream";
|
||||
import { createHash } from "crypto";
|
||||
import prisma from "../db/database";
|
||||
import cacheHandler from "../cache";
|
||||
import { systemConfig } from "../config/sys-conf";
|
||||
|
||||
export class FsObjectBackend extends ObjectBackend {
|
||||
private baseObjectPath: string;
|
||||
@ -16,7 +17,7 @@ export class FsObjectBackend extends ObjectBackend {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
const basePath = process.env.FS_BACKEND_PATH ?? "./.data/objects";
|
||||
const basePath = path.join(systemConfig.getDataFolder(), "objects");
|
||||
this.baseObjectPath = path.join(basePath, "objects");
|
||||
this.baseMetadataPath = path.join(basePath, "metadata");
|
||||
|
||||
|
||||
@ -9,9 +9,7 @@ export const useCertificateAuthority = () => {
|
||||
};
|
||||
|
||||
export default defineNitroPlugin(async () => {
|
||||
// const basePath = process.env.CLIENT_CERTIFICATES ?? "./certs";
|
||||
// fs.mkdirSync(basePath, { recursive: true });
|
||||
// const store = fsCertificateStore(basePath);
|
||||
// const store = fsCertificateStore();
|
||||
|
||||
ca = await CertificateAuthority.new(dbCertificateStore());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user