From 7b7d4f5467cbbf16d611135f5b05fb68c3497ec3 Mon Sep 17 00:00:00 2001 From: Michcio Date: Fri, 12 Aug 2022 20:29:16 +0200 Subject: [PATCH] Allow files storage path to be set explicitly Also added to the example config file - Johann150 Co-authored-by: Johann150 Changelog: Added --- .config/example.yml | 10 +++++++--- packages/backend/src/config/types.ts | 1 + .../backend/src/services/drive/internal-storage.ts | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.config/example.yml b/.config/example.yml index 873ecdb45..d2202b69f 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -120,9 +120,13 @@ redis: # Proxy remote files (default: false) #proxyRemoteFiles: true -#allowedPrivateNetworks: [ -# '127.0.0.1/32' -#] +# Storage path for files if stored locally (absolute path) +# default is to store it in ./files in the directory misskey is located in +#internalStoragePath: '/etc/misskey/files' # Upload or download file size limits (bytes) #maxFileSize: 262144000 + +#allowedPrivateNetworks: [ +# '127.0.0.1/32' +#] diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index 5c1db8669..89eafb093 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -63,6 +63,7 @@ export type Source = { mediaProxy?: string; proxyRemoteFiles?: boolean; + internalStoragePath?: string; }; /** diff --git a/packages/backend/src/services/drive/internal-storage.ts b/packages/backend/src/services/drive/internal-storage.ts index 8f76c81ca..fa8f0ef83 100644 --- a/packages/backend/src/services/drive/internal-storage.ts +++ b/packages/backend/src/services/drive/internal-storage.ts @@ -8,7 +8,7 @@ const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); export class InternalStorage { - private static readonly path = Path.resolve(_dirname, '../../../../../files'); + private static readonly path = config.internalStoragePath || Path.resolve(_dirname, '../../../../../files'); public static resolvePath = (key: string) => Path.resolve(InternalStorage.path, key);