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)
#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'
#]

View File

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

View File

@ -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);