-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: change env and proxy to getter and setter #9
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish Any Commit | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run prepublishOnly | ||
|
||
- run: npx pkg-pr-new publish |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,11 +35,11 @@ export class Application extends Emitter { | |
*/ | ||
static HttpError = HttpError; | ||
|
||
proxy: boolean; | ||
protected _proxy: boolean; | ||
protected _env: string; | ||
subdomainOffset: number; | ||
proxyIpHeader: string; | ||
maxIpsCount: number; | ||
env: string; | ||
keys?: string[]; | ||
middleware: MiddlewareFunc[]; | ||
ctxStorage: AsyncLocalStorage<ContextDelegation>; | ||
|
@@ -73,11 +73,11 @@ export class Application extends Emitter { | |
}) { | ||
super(); | ||
options = options || {}; | ||
this.proxy = options.proxy || false; | ||
this._proxy = options.proxy || false; | ||
this.subdomainOffset = options.subdomainOffset || 2; | ||
this.proxyIpHeader = options.proxyIpHeader || 'X-Forwarded-For'; | ||
this.maxIpsCount = options.maxIpsCount || 0; | ||
this.env = options.env || process.env.NODE_ENV || 'development'; | ||
this._env = options.env || process.env.NODE_ENV || 'development'; | ||
if (options.keys) this.keys = options.keys; | ||
this.middleware = []; | ||
this.ctxStorage = getAsyncLocalStorage(); | ||
|
@@ -90,6 +90,20 @@ export class Application extends Emitter { | |
this.response = this.ResponseClass.prototype; | ||
} | ||
|
||
get env() { | ||
return this._env; | ||
} | ||
set env(value: string) { | ||
this._env = value; | ||
} | ||
|
||
get proxy() { | ||
return this._proxy; | ||
} | ||
set proxy(value: boolean) { | ||
this._proxy = value; | ||
} | ||
|
||
Comment on lines
+93
to
+106
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification Ensure consistent usage of getter and setter methods for Direct access to
Analysis chainVerify the usage of new getter and setter methods. Ensure that the new getter and setter methods for Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the usage of new getter and setter methods for `env` and `proxy`.
# Test: Search for the usage of `env` and `proxy` getter and setter methods. Expect: Only the getter and setter methods should be used.
rg '\.env' --type=typescript
rg '\.proxy' --type=typescript
Length of output: 133 Script: #!/bin/bash
# Description: Verify the usage of new getter and setter methods for `env` and `proxy`.
# Test: Search for the usage of `env` and `proxy` getter and setter methods in TypeScript files.
rg '\.env' --glob '*.ts'
rg '\.proxy' --glob '*.ts'
Length of output: 2474 Script: #!/bin/bash
# Description: Extract context around the usage of `env` and `proxy` to verify if getter and setter methods are used.
# Extract context for `.env` usage
rg '\.env' --glob '*.ts' -C 3
# Extract context for `.proxy` usage
rg '\.proxy' --glob '*.ts' -C 3
Length of output: 12949 |
||
/** | ||
* Shorthand for: | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Unused dependency
@arethetypeswrong/cli
found inpackage.json
.The dependency
@arethetypeswrong/cli
is listed inpackage.json
but is not used anywhere in the codebase, npm scripts, or configuration files. Consider removing it to keep the project dependencies clean.package.json
: Line 55Analysis chain
Added
@arethetypeswrong/cli
as a new dev dependency.Ensure that this new dependency is necessary and used appropriately in the project.
Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 79
Script:
Length of output: 173