AnatolyUss/nmig

Wrong path resolution for extra_config.json

vinerich opened this issue · 2 comments

Hey there,
at first thank you for this nice work. Saved us a lot of time.

To come to the issue. In FsOps.ts you load the config files using different paths. I don't think it is intended the way it works atm.

config.json

export function readConfig(confPath: string, logsPath: string, configFileName: string = 'config.json'): Promise<any> {
    return new Promise<any>(resolve => {
        const pathToConfig = path.join(confPath, configFileName);

Note the path.join(confPath, configFileName). Results in path config/config.json

extra_config.json

export function readExtraConfig(config: any, confPath: string): Promise<any> {
    return new Promise<any>(resolve => {
        if (config.enable_extra_config !== true) {
            config.extraConfig = null;
            return resolve(config);
        }

        const pathToExtraConfig = path.join(confPath, 'config', 'extra_config.json');

Here you join the confPath + config path.join(confPath, 'config', 'extra_config.json') which results in the path config/config/extra_config.json.

@vinerich
Thanks a lot for the fix!

Hey there,
it was not that much but I'm glad you accepted it!

We ran into 2 other bugs, maybe I'll have the time to give you a minimal example. Nothing game breaking tbh.