2021-01-05 16:12:38 -05:00
|
|
|
/*
|
2021-01-06 15:36:07 -05:00
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2021-01-05 16:12:38 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
2020-07-25 14:26:00 -04:00
|
|
|
import { Module } from '@nestjs/common';
|
2020-10-30 17:35:12 -04:00
|
|
|
import { ConfigModule } from '@nestjs/config';
|
2021-08-29 12:45:46 -04:00
|
|
|
import { ScheduleModule } from '@nestjs/schedule';
|
2020-07-25 14:26:00 -04:00
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2021-08-29 12:45:46 -04:00
|
|
|
import { RouterModule, Routes } from 'nest-router';
|
|
|
|
|
|
|
|
import { PrivateApiModule } from './api/private/private-api.module';
|
2020-07-25 14:26:00 -04:00
|
|
|
import { PublicApiModule } from './api/public/public-api.module';
|
2021-08-29 12:45:46 -04:00
|
|
|
import { AuthModule } from './auth/auth.module';
|
2020-07-25 14:26:00 -04:00
|
|
|
import { AuthorsModule } from './authors/authors.module';
|
2021-08-29 12:45:46 -04:00
|
|
|
import appConfig from './config/app.config';
|
|
|
|
import authConfig from './config/auth.config';
|
|
|
|
import cspConfig from './config/csp.config';
|
|
|
|
import customizationConfig from './config/customization.config';
|
|
|
|
import databaseConfig from './config/database.config';
|
|
|
|
import externalConfig from './config/external-services.config';
|
|
|
|
import hstsConfig from './config/hsts.config';
|
|
|
|
import mediaConfig from './config/media.config';
|
|
|
|
import { FrontendConfigModule } from './frontend-config/frontend-config.module';
|
|
|
|
import { FrontendConfigService } from './frontend-config/frontend-config.service';
|
2020-09-27 15:48:42 -04:00
|
|
|
import { GroupsModule } from './groups/groups.module';
|
2020-07-25 14:26:00 -04:00
|
|
|
import { HistoryModule } from './history/history.module';
|
2021-08-08 15:59:23 -04:00
|
|
|
import { IdentityModule } from './identity/identity.module';
|
2020-09-27 15:48:42 -04:00
|
|
|
import { LoggerModule } from './logger/logger.module';
|
2020-10-16 16:38:31 -04:00
|
|
|
import { MediaModule } from './media/media.module';
|
2020-07-26 15:36:28 -04:00
|
|
|
import { MonitoringModule } from './monitoring/monitoring.module';
|
2020-09-27 15:48:42 -04:00
|
|
|
import { NotesModule } from './notes/notes.module';
|
2020-08-12 14:24:43 -04:00
|
|
|
import { PermissionsModule } from './permissions/permissions.module';
|
2020-09-27 15:48:42 -04:00
|
|
|
import { RevisionsModule } from './revisions/revisions.module';
|
|
|
|
import { UsersModule } from './users/users.module';
|
2021-02-15 04:26:12 -05:00
|
|
|
|
|
|
|
const routes: Routes = [
|
|
|
|
{
|
|
|
|
path: '/api/v2',
|
|
|
|
module: PublicApiModule,
|
|
|
|
},
|
2021-04-02 11:33:42 -04:00
|
|
|
{
|
|
|
|
path: '/api/private',
|
|
|
|
module: PrivateApiModule,
|
|
|
|
},
|
2021-02-15 04:26:12 -05:00
|
|
|
];
|
2020-07-21 15:24:56 -04:00
|
|
|
|
|
|
|
@Module({
|
2020-07-25 14:26:00 -04:00
|
|
|
imports: [
|
2021-02-15 04:26:12 -05:00
|
|
|
RouterModule.forRoutes(routes),
|
2020-07-25 14:26:00 -04:00
|
|
|
TypeOrmModule.forRoot({
|
|
|
|
type: 'sqlite',
|
|
|
|
database: './hedgedoc.sqlite',
|
|
|
|
autoLoadEntities: true,
|
2021-02-27 16:58:34 -05:00
|
|
|
synchronize: true, // ToDo: Remove this before release
|
2020-07-25 14:26:00 -04:00
|
|
|
}),
|
2020-10-30 17:35:12 -04:00
|
|
|
ConfigModule.forRoot({
|
2021-01-15 10:57:04 -05:00
|
|
|
load: [
|
|
|
|
appConfig,
|
|
|
|
mediaConfig,
|
|
|
|
hstsConfig,
|
|
|
|
cspConfig,
|
|
|
|
databaseConfig,
|
|
|
|
authConfig,
|
2021-03-01 15:10:16 -05:00
|
|
|
customizationConfig,
|
|
|
|
externalConfig,
|
2021-01-15 10:57:04 -05:00
|
|
|
],
|
2021-01-08 06:52:30 -05:00
|
|
|
isGlobal: true,
|
2020-10-30 17:35:12 -04:00
|
|
|
}),
|
2021-01-24 14:37:04 -05:00
|
|
|
ScheduleModule.forRoot(),
|
2020-07-25 14:26:00 -04:00
|
|
|
NotesModule,
|
|
|
|
UsersModule,
|
|
|
|
RevisionsModule,
|
|
|
|
AuthorsModule,
|
|
|
|
PublicApiModule,
|
2021-01-21 13:37:43 -05:00
|
|
|
PrivateApiModule,
|
2020-07-25 14:26:00 -04:00
|
|
|
HistoryModule,
|
2020-07-26 15:36:28 -04:00
|
|
|
MonitoringModule,
|
2020-08-12 14:24:43 -04:00
|
|
|
PermissionsModule,
|
|
|
|
GroupsModule,
|
2020-09-27 15:48:42 -04:00
|
|
|
LoggerModule,
|
2020-10-13 04:33:54 -04:00
|
|
|
MediaModule,
|
2021-01-15 12:53:09 -05:00
|
|
|
AuthModule,
|
2021-03-01 15:16:01 -05:00
|
|
|
FrontendConfigModule,
|
2021-08-08 15:59:23 -04:00
|
|
|
IdentityModule,
|
2020-07-25 14:26:00 -04:00
|
|
|
],
|
2020-07-21 15:24:56 -04:00
|
|
|
controllers: [],
|
2021-03-01 15:16:01 -05:00
|
|
|
providers: [FrontendConfigService],
|
2020-07-21 15:24:56 -04:00
|
|
|
})
|
2020-07-25 14:26:00 -04:00
|
|
|
export class AppModule {}
|