Skip to content

Commit

Permalink
feat(web): add proxy config support to file-server executor (#9225)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinhappel committed Mar 15, 2022
1 parent 5d5be04 commit 48d32ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/web/src/executors/file-server/file-server.impl.ts
@@ -1,5 +1,5 @@
import { exec, execSync } from 'child_process';
import { ExecutorContext, joinPathFragments, logger } from '@nrwl/devkit';
import { ExecutorContext, joinPathFragments } from '@nrwl/devkit';
import ignore from 'ignore';
import { readFileSync } from 'fs';
import { Schema } from './schema';
Expand All @@ -26,6 +26,12 @@ function getHttpServerArgs(options: Schema) {
if (options.proxyUrl) {
args.push(`-P ${options.proxyUrl}`);
}

if (options.proxyOptions) {
Object.keys(options.proxyOptions).forEach((key) => {
args.push(`--proxy-options.${key}`, options.proxyOptions[key]);
});
}
return args;
}

Expand Down
1 change: 1 addition & 0 deletions packages/web/src/executors/file-server/schema.d.ts
Expand Up @@ -9,4 +9,5 @@ export interface Schema {
parallel: boolean;
maxParallel?: number;
withDeps: boolean;
proxyOptions?: object;
}
12 changes: 12 additions & 0 deletions packages/web/src/executors/file-server/schema.json
Expand Up @@ -49,6 +49,18 @@
"proxyUrl": {
"type": "string",
"description": "URL to proxy unhandled requests to."
},
"proxyOptions": {
"type": "object",
"description": "Options for the proxy used by http-server",
"default": {},
"properties": {
"secure": {
"type": "boolean",
"default": false
}
},
"additionalProperties": true
}
},
"additionalProperties": false,
Expand Down

0 comments on commit 48d32ac

Please sign in to comment.