diff --git a/src/application.ts b/src/application.ts index 6c67c197b..d069bdb9b 100644 --- a/src/application.ts +++ b/src/application.ts @@ -40,7 +40,7 @@ export class Application extends Emitter { subdomainOffset: number; proxyIpHeader: string; maxIpsCount: number; - keys?: string[]; + protected _keys?: string[]; middleware: MiddlewareFunc[]; ctxStorage: AsyncLocalStorage; silent: boolean; @@ -78,7 +78,9 @@ export class Application extends Emitter { this.proxyIpHeader = options.proxyIpHeader || 'X-Forwarded-For'; this.maxIpsCount = options.maxIpsCount || 0; this._env = options.env || process.env.NODE_ENV || 'development'; - if (options.keys) this.keys = options.keys; + if (options.keys) { + this._keys = options.keys; + } this.middleware = []; this.ctxStorage = getAsyncLocalStorage(); this.silent = false; @@ -90,6 +92,14 @@ export class Application extends Emitter { this.response = this.ResponseClass.prototype; } + get keys() { + return this._keys; + } + + set keys(value: string[] | undefined) { + this._keys = value; + } + get env() { return this._env; }