Skip to content

Commit

Permalink
fix: change keys to getter and setter
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jul 7, 2024
1 parent 5946af5 commit e0dc2a0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Application extends Emitter {
subdomainOffset: number;
proxyIpHeader: string;
maxIpsCount: number;
keys?: string[];
protected _keys?: string[];
middleware: MiddlewareFunc[];
ctxStorage: AsyncLocalStorage<ContextDelegation>;
silent: boolean;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit e0dc2a0

Please sign in to comment.