UNPKG

@sap/xsodata

Version:

Expose data from a HANA database as OData V2 service with help of .xsodata files.

41 lines (35 loc) 1.36 kB
'use strict'; /** * Configuration. * @module configuration */ const utils = require('./utils/utils'); const configuration = require('./configuration'); /** * Holds the runtime configuration for the OData handler. * Filled with HandlerOptions but also contains function to modify the handleroptions (e.g. for increasing a counter) * @constructor */ exports.HandlerConfiguration = function (handlerOptions) { this.lastUsedNetworkRequestID = 0; this.logger = null; this.serviceConfiguration = handlerOptions.serviceConfiguration; this.servingDirectory = !utils.endsWith( handlerOptions.serviceConfiguration, '.xsodata' ); this.defaultSchema = handlerOptions.defaultSchema; this.dbConfiguration = handlerOptions.dbConfiguration; this.dbClient = handlerOptions.dbClient; this.mode = handlerOptions.mode || configuration.modes.productive; this.moduleLoader = handlerOptions.moduleLoader; this.DATABASE_TYPE = handlerOptions.DATABASE_TYPE; this.DATABASE_VERSION = handlerOptions.DATABASE_VERSION; this.maxBodySize = handlerOptions.maxBodySize || '10mb'; }; exports.HandlerConfiguration.prototype.setLogger = function (logger) { this.logger = logger; }; exports.HandlerConfiguration.prototype.getNextNetworkRequestID = function () { return this.lastUsedNetworkRequestID++; };