Skip to content

Commit eda8e41

Browse files
feat: Add option to pass arguments to func start command (#290)
* Add option to pass arguments to func start command Added the `--func-args` option that allows passing additional arguments to the func start command. This will enable scenarios like attaching a debugger to the func host. * Document --func-args in readme
1 parent 4a34a08 commit eda8e41

4 files changed

Lines changed: 7 additions & 1 deletion

File tree

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ If you need to override the default values, provide the following options:
179179
| `--ssl-key` | SSL key to use for serving HTTPS | | `--ssl-key="/home/user/ssl/example.key"` |
180180
| `--run` | Run a command at startup | | `--run="cd app & npm start"` |
181181
| `--devserver-timeout` | The time to wait(in ms) for the dev server to start | 30000 | `--devserver-timeout=60000` |
182+
| `--func-args` | Additional arguments to pass to `func start` | | `--func-args="--javascript"` |
182183

183184
## Local authentication & authorization emulation
184185

src/cli/commands/start.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export async function start(startContext: string, options: SWACLIConfig) {
8484
const funcBinary = "func";
8585
// serve the api if and only if the user provides a folder via the --api-location flag
8686
if (isApiLocationExistsOnDisk) {
87-
serveApiCommand = `cd "${userWorkflowConfig.apiLocation}" && ${funcBinary} start --cors "*" --port ${options.apiPort}`;
87+
serveApiCommand = `cd "${userWorkflowConfig.apiLocation}" && ${funcBinary} start --cors "*" --port ${options.apiPort} ${
88+
options.funcArgs ?? ""
89+
}`;
8890
}
8991
}
9092
}

src/cli/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export async function run(argv?: string[]) {
5757
DEFAULT_CONFIG.devserverTimeout
5858
)
5959

60+
.option("--func-args <funcArgs>", "pass additional arguments to the func start command")
61+
6062
.action(async (context: string = `.${path.sep}`, options: SWACLIConfig) => {
6163
options = {
6264
...options,

src/swa.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ declare type SWACLIConfig = GithubActionWorkflow & {
7676
customUrlScheme?: string;
7777
overridableErrorCode?: number[];
7878
devserverTimeout?: number;
79+
funcArgs?: string;
7980
};
8081

8182
declare type ResponseOptions = {

0 commit comments

Comments
 (0)