export function setup()

in src/setup.ts [18:49]


export function setup(opts: SetupOptions): void {
    if (setupLocked) {
        throw new AzFuncSystemError("Setup options can't be changed after app startup has finished.");
    }

    if (opts.enableHttpStream) {
        // NOTE: coreApi.log was coincidentally added the same time as http streaming,
        // so we can use that to validate the host version instead of messing with semver parsing
        const coreApi = tryGetCoreApiLazy();
        if (coreApi && !coreApi.log) {
            throw new AzFuncSystemError(`HTTP streaming requires Azure Functions Host v4.28 or higher.`);
        }
    }

    if (isDefined(opts.enableHttpStream)) {
        enableHttpStream = opts.enableHttpStream;
    }

    if (opts.capabilities) {
        for (let [key, val] of Object.entries(opts.capabilities)) {
            if (isDefined(val)) {
                val = String(val);
                workerSystemLog('debug', `Capability ${key} set to ${val}.`);
                capabilities[key] = val;
            }
        }
    }

    if (enableHttpStream) {
        workerSystemLog('debug', `HTTP streaming enabled.`);
    }
}