Skip to content

Commit

Permalink
fix: remove DRY_RUN env var and --dry-run flag (#210)
Browse files Browse the repository at this point in the history
Free the DRY_RUN env var name to be used for other purposes by function
authors.

The original intent of the DRY_RUN was to be used at build time for GCF
to validate function syntax without starting the server, but this was
never implemented. For local testing purposes, simply starting the
functions framework server is a better method.
  • Loading branch information
anniefu authored Dec 7, 2022
1 parent 0ced0d2 commit f013ab4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ You can configure the Functions Framework using command-line flags or environmen
| `--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`, `event` or `cloudevent` |
| `--source` | `FUNCTION_SOURCE` | The path to the file containing your function. Default: `main.py` (in the current working directory) |
| `--debug` | `DEBUG` | A flag that allows to run functions-framework to run in debug mode, including live reloading. Default: `False` |
| `--dry-run` | `DRY_RUN` | A flag that allows for testing the function build from the configuration without creating a server. Default: `False` |

## Enable Google Cloud Function Events

Expand Down
10 changes: 2 additions & 8 deletions src/functions_framework/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
@click.option("--host", envvar="HOST", type=click.STRING, default="0.0.0.0")
@click.option("--port", envvar="PORT", type=click.INT, default=8080)
@click.option("--debug", envvar="DEBUG", is_flag=True)
@click.option("--dry-run", envvar="DRY_RUN", is_flag=True)
def _cli(target, source, signature_type, host, port, debug, dry_run):
def _cli(target, source, signature_type, host, port, debug):
app = create_app(target, source, signature_type)
if dry_run:
click.echo("Function: {}".format(target))
click.echo("URL: http://{}:{}/".format(host, port))
click.echo("Dry run successful, shutting down.")
else:
create_server(app, debug).run(host, port)
create_server(app, debug).run(host, port)
12 changes: 0 additions & 12 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,6 @@ def test_cli_no_arguments():
[pretend.call("foo", None, "event")],
[pretend.call("0.0.0.0", 8080)],
),
(
["--target", "foo", "--dry-run"],
{},
[pretend.call("foo", None, "http")],
[],
),
(
[],
{"FUNCTION_TARGET": "foo", "DRY_RUN": "True"},
[pretend.call("foo", None, "http")],
[],
),
(
["--target", "foo", "--host", "127.0.0.1"],
{},
Expand Down

0 comments on commit f013ab4

Please sign in to comment.