Skip to content

Commit

Permalink
Merge pull request #2908 from martian0x80/eval-envvar-on-run
Browse files Browse the repository at this point in the history
Evaluate HOST, PORT, and PROXY env vars when Dash.run() is invoked
  • Loading branch information
T4rk1n authored Jul 3, 2024
2 parents bbd013c + 8adf717 commit f0d1645
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- [#2898](https://github.com/plotly/dash/pull/2898) Fix error thrown when using non-existent components in callback running keyword. Fixes [#2897](https://github.com/plotly/dash/issues/2897).
- [#2892](https://github.com/plotly/dash/pull/2860) Fix ensures dcc.Dropdown menu maxHeight option works with Datatable. Fixes [#2529](https://github.com/plotly/dash/issues/2529) [#2225](https://github.com/plotly/dash/issues/2225)
- [#2896](https://github.com/plotly/dash/pull/2896) The tabIndex parameter of Div can accept number or string type. Fixes [#2891](https://github.com/plotly/dash/issues/2891)
- [#2908](https://github.com/plotly/dash/pull/2908) Fix when environment variables are ignored by Dash.run() at runtime. Fixes [#2902](https://github.com/plotly/dash/issues/2902)

## [2.17.1] - 2024-06-12

Expand Down
12 changes: 9 additions & 3 deletions dash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -1981,9 +1981,9 @@ def delete_resource(resources):

def run(
self,
host=os.getenv("HOST", "127.0.0.1"),
port=os.getenv("PORT", "8050"),
proxy=os.getenv("DASH_PROXY", None),
host="127.0.0.1",
port="8050",
proxy=None,
debug=None,
jupyter_mode: JupyterDisplayMode = None,
jupyter_width="100%",
Expand Down Expand Up @@ -2109,6 +2109,12 @@ def run(
dev_tools_prune_errors,
)

# Evaluate the env variables at runtime

host = os.getenv("HOST", host)
port = os.getenv("PORT", port)
proxy = os.getenv("DASH_PROXY", proxy)

# Verify port value
try:
port = int(port)
Expand Down

0 comments on commit f0d1645

Please sign in to comment.