Skip to content

Change the default function directory to the current working directory instead of root #77

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

Merged
merged 1 commit into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Command-line flag | Environment variable | Description
`--port` | `PORT` | The port on which the Functions Framework listens for requests. Default: `8080`
`--target` | `FUNCTION_TARGET` | The name of the exported function to be invoked in response to requests. Default: `function`
`--signature-type` | `FUNCTION_SIGNATURE_TYPE` | The signature used when writing your function. Controls unmarshalling rules and determines which arguments are used to invoke your function. Default: `http`; accepted values: `http` or `event`
`--source` | `FUNCTION_SOURCE` | The path of your project directory where you want to start. Functions framework always look only at root path, setting this option will look for your function in any other folder. Default: `/`
`--source` | `FUNCTION_SOURCE` | The path to the directory of your function. Default: `cwd` (the current working directory)

You can set command-line flags in your `package.json` via the `start` script.
For example:
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const argv = minimist(process.argv, {

const CODE_LOCATION = resolve(
process.cwd(),
argv[FLAG.SOURCE] || process.env[ENV.SOURCE] || '/'
argv[FLAG.SOURCE] || process.env[ENV.SOURCE]
);
const PORT = argv[FLAG.PORT] || process.env[ENV.PORT] || '8080';
const TARGET = argv[FLAG.TARGET] || process.env[ENV.TARGET] || 'function';
Expand Down