mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00
Get port and upload path from config
Signed-off-by: David Mehren <git@herrmehren.de> Co-authored-by: Yannick Bungers <git@innay.de>
This commit is contained in:
parent
cbd4684785
commit
0e7845e38f
3 changed files with 21 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { promises as fs } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
|
@ -13,11 +14,16 @@ import { BackendData } from '../media-upload.entity';
|
|||
|
||||
@Injectable()
|
||||
export class FilesystemBackend implements MediaBackend {
|
||||
// TODO: Get uploads directory from config
|
||||
uploadDirectory = './uploads';
|
||||
|
||||
constructor(private readonly logger: ConsoleLoggerService) {
|
||||
constructor(
|
||||
private readonly logger: ConsoleLoggerService,
|
||||
private configService: ConfigService,
|
||||
) {
|
||||
this.logger.setContext(FilesystemBackend.name);
|
||||
this.uploadDirectory = configService.get<string>(
|
||||
'media.backend.filesystem.uploadPath',
|
||||
);
|
||||
}
|
||||
|
||||
private getFilePath(fileName: string): string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue