Skip to content

Commit

Permalink
refactor: removed a bunch of proxied methods from provider to app
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The following Provider instance getters/setters are
removed: subdomainOffset, proxyIpHeader, maxIpsCount, keys. You can
access the underlying Koa app via `provider.app` if you have the need
to use these.
  • Loading branch information
panva committed Mar 18, 2020
1 parent 4cf4cc6 commit 3fb32e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
22 changes: 10 additions & 12 deletions lib/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ class Provider extends events.EventEmitter {
return this.app.listen(...args);
}

/* istanbul ignore next */
get proxy() {
return this.app.proxy;
}

/* istanbul ignore next */
set proxy(value) {
this.app.proxy = value;
}

get Claims() { return instance(this).Claims; }

get BaseToken() { return instance(this).BaseToken; }
Expand Down Expand Up @@ -278,16 +288,4 @@ class Provider extends events.EventEmitter {
get requestUriCache() { return instance(this).requestUriCache; }
}

/* istanbul ignore next */
['env', 'proxy', 'subdomainOffset', 'keys', 'proxyIpHeader', 'maxIpsCount'].forEach((method) => {
Object.defineProperty(Provider.prototype, method, {
get() {
return this.app[method];
},
set(value) {
this.app[method] = value;
},
});
});

module.exports = Provider;
5 changes: 0 additions & 5 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1119,12 +1119,7 @@ export class Provider extends events.EventEmitter {
readonly issuer: string;
readonly app: Koa;

env?: Koa['env'];
proxy?: Koa['proxy'];
subdomainOffset?: number;
proxyIpHeader?: string;
maxIpsCount?: number;
keys?: Koa['keys'];
listen: Koa['listen'];
callback: Koa['callback'];

Expand Down

0 comments on commit 3fb32e7

Please sign in to comment.