import deepmerge from "deepmerge" ; import { inject , injectable } from "inversify" ; import TYPES from "ioc/types" ; import { IDirectoryManager , ISettingsManager } from "managers" ; import ConfigManager from "managers/ConfigManager" ; import { ICommonSettings } from "models/settings" ; import applicationSettings from "settings/internal/settings" ; /** Manages parsing settings from application settings files. */ @ injectable ( ) class SettingsManager extends ConfigManager implements ISettingsManager { /** The internally held settings for this manager. */ private _settings ? : ICommonSettings ; param directoryManager public constructor ( @ inject ( TYPES . IDirectoryManager ) directoryManager ) { super ( directoryManager ) ; } inheritDoc public get settings ( ) : ICommonSettings { if ( ! this . _settings ) { this . _settings = this . retrieve ( ) ; } return this . _settings ; } returns private retrieve ( ) { const userSettings = this . parseFile < ICommonSettings > ( "freeman.settings.json" ) ; return userSettings ? deepmerge ( applicationSettings , userSettings ) : applicationSettings ; } } export default SettingsManager ;