UNPKG

@deepkit/framework

Version:

103 lines 6.98 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FrameworkConfig = exports.BrokerConfig = void 0; /* * Deepkit Framework * Copyright (C) 2021 Deepkit UG, Marc J. Schmidt * * This program is free software: you can redistribute it and/or modify * it under the terms of the MIT License. * * You should have received a copy of the MIT License along with this program. */ const http_1 = require("@deepkit/http"); const isWindows = 'undefined' !== typeof process ? process.platform === 'win32' : false; class BrokerConfig { constructor() { /** * @description If startOnBootstrap is true, the broker server starts at this address. Unix socket path or host:port combination */ this.listen = isWindows ? 'localhost:8811' : 'var/broker.sock'; /** * @description If a different broker server should be used, this is its address. Unix socket path or host:port combination. */ this.host = isWindows ? 'localhost:8811' : 'var/broker.sock'; /** * @description Automatically starts a single broker in the main process. Disable it if you have a custom broker node. */ this.startOnBootstrap = true; } } exports.BrokerConfig = BrokerConfig; BrokerConfig.__type = ['listen', function () { return isWindows ? 'localhost:8811' : 'var/broker.sock'; }, 'If startOnBootstrap is true, the broker server starts at this address. Unix socket path or host:port combination', 'host', function () { return isWindows ? 'localhost:8811' : 'var/broker.sock'; }, 'If a different broker server should be used, this is its address. Unix socket path or host:port combination.', 'startOnBootstrap', function () { return true; }, 'Automatically starts a single broker in the main process. Disable it if you have a custom broker node.', 'BrokerConfig', '&3!>"?#P&&FJ3$>%?&)3\'>(?)5w*']; class FrameworkConfig { constructor() { this.host = '0.0.0.0'; //binding to localhost is roughly 20% faster. this.port = 8080; this.path = '/'; /** * The compression level to use when using the zlib module. * * 0 means no compression, and 9 is the maximum compression. * * Disabled (0) per default. 6 is a good default value if you want to enable compression. */ this.compression = 0; /** * @description A value of 0 means the main process handles requests alone. A value of > 0 means the main process does not handle any requests and anything is redirected to workers. */ this.workers = 0; /** * When server is shutting down gracefully, this timeout is used to wait for all connections to be closed. * Default is 5 seconds. */ this.gracefulShutdownTimeout = 5; /** * @description Enables HTTPS server. */ this.ssl = false; /** * @description Per default the folder specified in publicDir is available under /. Change that to a URL prefix of your choice. */ this.publicDirPrefix = '/'; this.debug = false; /** * @description If set, allows to call RPC methods via HTTP. The value is the base URL for the RPC calls. * Use e.g. `/rpc/v1` */ this.httpRpcBasePath = ''; this.debugUrl = '_debug'; /** * Whether profiling is enabled. This is automatically enabled when debug is enabled, * but can be enabled separately. */ this.profile = false; this.varPath = 'var/'; /** * @description Relative to {varPath} option. */ this.debugStorePath = 'debug/'; /** * @description print http request logs to logger. */ this.httpLog = true; /** * @description Whether all registered database should be migrated automatically on startup. */ this.migrateOnStartup = false; this.migrationDir = 'migrations'; this.broker = new BrokerConfig; /** * Will be forwarded to HttpModule. * @see HttpConfig */ this.http = new http_1.HttpConfig; /** * If true logs all routes and rpc controllers on startup. */ this.logStartup = true; } } exports.FrameworkConfig = FrameworkConfig; FrameworkConfig.__type = ['host', function () { return '0.0.0.0'; }, 'port', function () { return 8080; }, 'httpsPort', 'If httpsPort and ssl is defined, then the https server is started additional to the http-server.', 'selfSigned', 'If for ssl: true the certificate and key should be automatically generated.', 'path', function () { return '/'; }, 'compression', function () { return 0; }, 'workers', function () { return 0; }, 'A value of 0 means the main process handles requests alone. A value of > 0 means the main process does not handle any requests and anything is redirected to workers.', 'gracefulShutdownTimeout', function () { return 5; }, 'ssl', function () { return false; }, 'Enables HTTPS server.', 'sslOptions', 'Same interface as tls.SecureContextOptions & tls.TlsOptions.', 'sslKey', 'A file path to a ssl key file for https.', 'sslCertificate', 'A file path to a certificate file for https.', 'sslCa', 'A file path to a ca file for https.', 'sslCrl', 'A file path to a ca file for https', 'server', 'custom server created by node http/https module.', 'maxPayload', 'publicDir', 'A path to a folder that should be served per default. Relative to cwd.', 'publicDirPrefix', function () { return '/'; }, 'Per default the folder specified in publicDir is available under /. Change that to a URL prefix of your choice.', 'debug', function () { return false; }, 'httpRpcBasePath', function () { return ''; }, 'If set, allows to call RPC methods via HTTP. The value is the base URL for the RPC calls.\nUse e.g. `/rpc/v1`', 'debugUrl', function () { return '_debug'; }, 'profile', function () { return false; }, 'debugBrokerHost', 'IP:Port or unix socket name or named pipes.', 'varPath', function () { return 'var/'; }, 'debugStorePath', function () { return 'debug/'; }, 'Relative to {varPath} option.', 'httpLog', function () { return true; }, 'print http request logs to logger.', 'session', 'The session ClassType', 'migrateOnStartup', function () { return false; }, 'Whether all registered database should be migrated automatically on startup.', 'migrationDir', function () { return 'migrations'; }, () => BrokerConfig, 'broker', function () { return new BrokerConfig; }, () => http_1.HttpConfig, 'http', function () { return new http_1.HttpConfig; }, 'logStartup', function () { return true; }, 'FrameworkConfig', '&3!>"\'3#>$\'3%8?&)3\'8?(&3)>*\'3+>,\'3->.?/\'30>1)32>3?4"358?6&378?8&398?:&3;8?<&3=8?>"3?8?@\'3A8&3B8?C&3D>E?F)3G>H&3I>J?K&3L>M)3N>O&3P8?Q&3R>S&3T>U?V)3W>X?Y"3Z8?[)3\\>]?^&3_>`P7a3b>cP7d3e>f)3g>h5wi']; //# sourceMappingURL=module.config.js.map