Skip to content

Commit

Permalink
add option to bind to the local IP
Browse files Browse the repository at this point in the history
* Some platforms except for linux don't support correctly binding to IPs, added an env variable to bind to the correct interface for local development
  • Loading branch information
Wason1797 committed Nov 26, 2024
1 parent d27fbf7 commit 855a91d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/app/config/env_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Settings(BaseSettings):
REPLICATION: ReplicationType = ReplicationType.NONE
WRITE_TO_BACKUP: bool = True
MAIN_SERVER_URI: Optional[str] = None
BIND: Optional[str] = None

model_config = SettingsConfigDict(env_file=".env")

Expand Down
2 changes: 1 addition & 1 deletion server/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def main() -> None:
PayloadValidator.init_validator(EnvManager.SECRET_KEY)

log.info("Initializing COAP resources")
binds = ("localhost", None) if EnvManager.is_dev() else None
binds = (EnvManager.BIND or "localhost", None) if EnvManager.is_dev() else None
main_coap_context = await aiocoap.Context.create_server_context(None, bind=binds)

server = resource.Site()
Expand Down

0 comments on commit 855a91d

Please sign in to comment.