File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414from mp_api .client .core .utils import validate_api_key
1515
1616if TYPE_CHECKING :
17+ from collections .abc import Sequence
1718 from typing import Any
1819
1920
@@ -40,9 +41,15 @@ def get_request_headers() -> dict[str, Any]:
4041 return request .headers if has_request_context () else {}
4142
4243
43- def is_dev_env () -> bool :
44+ def is_dev_env (
45+ localhosts : Sequence [str ] = ("localhost:" , "127.0.0.1:" , "0.0.0.0:" )
46+ ) -> bool :
4447 """Determine if current env is local/developmental or production.
4548
49+ Args:
50+ localhosts (Sequence of str) : A set of host prefixes for checking
51+ if the current environment is locally deployed.
52+
4653 Returns:
4754 bool: True if the environment is locally hosted.
4855 """
@@ -51,7 +58,7 @@ def is_dev_env() -> bool:
5158 if not has_request_context ()
5259 else get_request_headers ()
5360 .get ("Host" , "" )
54- .startswith (( "localhost:" , "127.0.0.1:" , "0.0.0.0:" ) )
61+ .startswith (localhosts )
5562 )
5663
5764
You can’t perform that action at this time.
0 commit comments