Skip to content

Commit f0d1645

Browse files
authored
Merge pull request #2908 from martian0x80/eval-envvar-on-run
Evaluate HOST, PORT, and PROXY env vars when Dash.run() is invoked
2 parents bbd013c + 8adf717 commit f0d1645

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1313
- [#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).
1414
- [#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)
1515
- [#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)
16+
- [#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)
1617

1718
## [2.17.1] - 2024-06-12
1819

dash/dash.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,9 +1981,9 @@ def delete_resource(resources):
19811981

19821982
def run(
19831983
self,
1984-
host=os.getenv("HOST", "127.0.0.1"),
1985-
port=os.getenv("PORT", "8050"),
1986-
proxy=os.getenv("DASH_PROXY", None),
1984+
host="127.0.0.1",
1985+
port="8050",
1986+
proxy=None,
19871987
debug=None,
19881988
jupyter_mode: JupyterDisplayMode = None,
19891989
jupyter_width="100%",
@@ -2109,6 +2109,12 @@ def run(
21092109
dev_tools_prune_errors,
21102110
)
21112111

2112+
# Evaluate the env variables at runtime
2113+
2114+
host = os.getenv("HOST", host)
2115+
port = os.getenv("PORT", port)
2116+
proxy = os.getenv("DASH_PROXY", proxy)
2117+
21122118
# Verify port value
21132119
try:
21142120
port = int(port)

0 commit comments

Comments
 (0)