From 7046e3c07d3ceaa13964921ec0b218e0c76556a1 Mon Sep 17 00:00:00 2001 From: Caspar Neumann Date: Fri, 17 Nov 2023 14:16:04 +0100 Subject: [PATCH] Revert "review comment: solve use of config.get" This reverts commit 8045a528dfd709bd0669ec3f560d20bb6c6a6a5f. --- .../h5p-library-management.config.ts | 3 --- .../service/h5p-library-management.service.ts | 18 +++--------------- 2 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 apps/server/src/modules/h5p-library-management/h5p-library-management.config.ts diff --git a/apps/server/src/modules/h5p-library-management/h5p-library-management.config.ts b/apps/server/src/modules/h5p-library-management/h5p-library-management.config.ts deleted file mode 100644 index 78130f9c3f8..00000000000 --- a/apps/server/src/modules/h5p-library-management/h5p-library-management.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface H5pLibraryManagementConfig { - libraryListPath: string; -} diff --git a/apps/server/src/modules/h5p-library-management/service/h5p-library-management.service.ts b/apps/server/src/modules/h5p-library-management/service/h5p-library-management.service.ts index 0eeb648a21e..d45ddbf39dc 100644 --- a/apps/server/src/modules/h5p-library-management/service/h5p-library-management.service.ts +++ b/apps/server/src/modules/h5p-library-management/service/h5p-library-management.service.ts @@ -12,10 +12,9 @@ import ContentManager from '@lumieducation/h5p-server/build/src/ContentManager'; import ContentTypeInformationRepository from '@lumieducation/h5p-server/build/src/ContentTypeInformationRepository'; import { Injectable } from '@nestjs/common'; import { ContentStorage, LibraryStorage } from '@src/modules/h5p-editor'; +import { Configuration } from '@hpi-schul-cloud/commons'; import { readFileSync } from 'fs'; import { parse } from 'yaml'; -import { ConfigService } from '@nestjs/config'; -import { H5pLibraryManagementConfig } from '../h5p-library-management.config'; const h5pConfig = new H5PConfig(undefined, { baseUrl: '/api/v3/h5p-editor', @@ -35,13 +34,7 @@ export class H5PLibraryManagementService { libraryWishList: string[]; - libraryListPath: string; - - constructor( - private readonly libraryStorage: LibraryStorage, - private readonly contentStorage: ContentStorage, - private configService: ConfigService - ) { + constructor(private readonly libraryStorage: LibraryStorage, private readonly contentStorage: ContentStorage) { const kvCache = new cacheImplementations.CachedKeyValueStorage('kvcache'); this.contentTypeCache = new ContentTypeCache(h5pConfig, kvCache); this.libraryManager = new LibraryManager( @@ -56,12 +49,7 @@ export class H5PLibraryManagementService { this.contentTypeRepo = new ContentTypeInformationRepository(this.contentTypeCache, this.libraryManager, h5pConfig); const contentManager = new ContentManager(this.contentStorage); this.libraryAdministration = new LibraryAdministration(this.libraryManager, contentManager); - const config = this.configService.get( - 'H5P_EDITOR__LIBRARY_LIST_PATH' - ) as H5pLibraryManagementConfig; - this.libraryListPath = config.libraryListPath; - - const librariesYamlContent = readFileSync(this.libraryListPath, { + const librariesYamlContent = readFileSync(Configuration.get('H5P_EDITOR__LIBRARY_LIST_PATH') as string, { encoding: 'utf-8', }); this.libraryWishList = (parse(librariesYamlContent) as { h5p_libraries: string[] }).h5p_libraries;