private updateContextArgs()

in lib/template/app-context.ts [105:130]


    private updateContextArgs(config: any, app: cdk.App, contextArgs: string[]) {
        for (var key of contextArgs) {
            const jsonKeys = key.split('.');
            let oldValue = '';
            const newValue: string = app?.node.tryGetContext(key);

            if (jsonKeys.length == 1) {
                oldValue = config[jsonKeys[0]];
                config[jsonKeys[0]] = newValue;
            } else if (jsonKeys.length == 2) {
                oldValue = config[jsonKeys[0]][jsonKeys[1]]
                config[jsonKeys[0]][jsonKeys[1]] = newValue;
            } else if (jsonKeys.length == 3) {
                oldValue = config[jsonKeys[0]][jsonKeys[1]][jsonKeys[2]];
                config[jsonKeys[0]][jsonKeys[1]][jsonKeys[2]] = newValue;
            } else if (jsonKeys.length == 4) {
                oldValue = config[jsonKeys[0]][jsonKeys[1]][jsonKeys[2]][jsonKeys[3]];
                config[jsonKeys[0]][jsonKeys[1]][jsonKeys[2]][jsonKeys[3]] = newValue;
            } else if (jsonKeys.length == 5) {
                oldValue = config[jsonKeys[0]][jsonKeys[1]][jsonKeys[2]][jsonKeys[3]][jsonKeys[4]];
                config[jsonKeys[0]][jsonKeys[1]][jsonKeys[2]][jsonKeys[3]][jsonKeys[4]] = newValue;
            }

            console.error(`updateContextArgs: ${key} = ${oldValue}-->${newValue}`);
        }
    }