private loadConfig()

in lib/template/app-context.ts [67:90]


    private loadConfig(cdkApp: cdk.App, key: string, contextArgs?: string[]): any {
        var fromType = 'Input-Parameter';
        var configFilePath = cdkApp.node.tryGetContext(key); //'APP_CONFIG'

        if (configFilePath == undefined) {
            configFilePath = env.get(key).asString();

            if (configFilePath != undefined && configFilePath.length > 0) {
                fromType = 'Environment-Variable';
            } else {
                configFilePath = undefined;
            }
        }

        if (configFilePath == undefined) {
            console.error(`==> CDK App-Config File is empty, 
        please check your environment variable(Usage: export ${key}=config/app-config-xxx.json) 
                        or input parameter(--context=${key}=config/app-config-xxx.json)`);
            return false;
        } else {
            console.info(`==> CDK App-Config File is ${configFilePath}, which is from ${fromType}.`);
            return this.loadConfigFromFile(configFilePath, cdkApp, contextArgs);
        }
    }