HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/ZelfVerkopen/zelfverkopen.nl/resources/assets/ts/services/core/ConfigService.ts
import * as core from '../../config/core.json'

export class ConfigService {
    constructor()
    {
    }

    public static get(key:string): string
    {
        let configKeyComponents = key.split('.');
        if(configKeyComponents.length < 2) {
            console.error("Config key '"+key+"' must at least have one . separating a configuration file from a configuration value. Ignoring the key by returning an empty string");
            return '';
        }

        let file:string = configKeyComponents[0];
        let option:string = configKeyComponents[1];

        switch (file)
        {
            case 'core':
                if(core.hasOwnProperty(option)) return core[option];
                break
        }

        console.warn("Config key '"+key+"' did not exist.");
        return '';
    }
}