Check config on load (#4170)

Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
Aya Morisawa
2019-02-06 22:44:55 +09:00
committed by syuilo
parent 41ba06a5e6
commit 96bc17aa10
19 changed files with 195 additions and 125 deletions

View File

@ -50,8 +50,9 @@ async function save(path: string, name: string, type: string, hash: string, size
if (type === 'image/webp') ext = '.webp';
}
const baseUrl = config.drive.baseUrl
|| `${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? `:${config.drive.config.port}` : '' }/${ config.drive.bucket }`;
const baseUrl = config.drive.baseUrl.getOrElse(
`${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? `:${config.drive.config.port}` : '' }/${ config.drive.bucket }`
);
// for original
const key = `${config.drive.prefix}/${uuid.v4()}${ext}`;