Allow files storage path to be set explicitly

Also added to the example config file - Johann150

Co-authored-by: Johann150 <johann.galle@protonmail.com>
Changelog: Added
This commit is contained in:
Michcio 2022-08-12 20:29:16 +02:00 committed by Johann150
parent f0b91a62c9
commit 7b7d4f5467
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
3 changed files with 9 additions and 4 deletions

View file

@ -120,9 +120,13 @@ redis:
# Proxy remote files (default: false) # Proxy remote files (default: false)
#proxyRemoteFiles: true #proxyRemoteFiles: true
#allowedPrivateNetworks: [ # Storage path for files if stored locally (absolute path)
# '127.0.0.1/32' # 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) # Upload or download file size limits (bytes)
#maxFileSize: 262144000 #maxFileSize: 262144000
#allowedPrivateNetworks: [
# '127.0.0.1/32'
#]

View file

@ -63,6 +63,7 @@ export type Source = {
mediaProxy?: string; mediaProxy?: string;
proxyRemoteFiles?: boolean; proxyRemoteFiles?: boolean;
internalStoragePath?: string;
}; };
/** /**

View file

@ -8,7 +8,7 @@ const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename); const _dirname = dirname(_filename);
export class InternalStorage { 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); public static resolvePath = (key: string) => Path.resolve(InternalStorage.path, key);