mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 17:55:17 -04:00

Co-authored-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: Erik Michelson <github@erik.michelson.eu>
34 lines
1 KiB
TypeScript
34 lines
1 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2025 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
import { PermissionLevel } from '@hedgedoc/commons';
|
|
import { ConfigFactoryKeyHost, registerAs } from '@nestjs/config';
|
|
import { ConfigFactory } from '@nestjs/config/dist/interfaces';
|
|
|
|
import { DefaultAccessLevel } from '../default-access-level.enum';
|
|
import { NoteConfig } from '../note.config';
|
|
|
|
export function createDefaultMockNoteConfig(): NoteConfig {
|
|
return {
|
|
maxDocumentLength: 100000,
|
|
forbiddenNoteIds: ['forbiddenNoteId'],
|
|
permissions: {
|
|
default: {
|
|
everyone: DefaultAccessLevel.READ,
|
|
loggedIn: DefaultAccessLevel.WRITE,
|
|
},
|
|
},
|
|
guestAccess: PermissionLevel.CREATE,
|
|
revisionRetentionDays: 0,
|
|
};
|
|
}
|
|
|
|
export function registerNoteConfig(
|
|
noteConfig: NoteConfig,
|
|
): ConfigFactory<NoteConfig> & ConfigFactoryKeyHost<NoteConfig> {
|
|
return registerAs('noteConfig', (): NoteConfig => noteConfig);
|
|
}
|
|
|
|
export default registerNoteConfig(createDefaultMockNoteConfig());
|