Skip to content

Commit

Permalink
service: Add option to modify listen address
Browse files Browse the repository at this point in the history
Previously, uvicorn only listened on `0.0.0.0`, which may be a
security risk in some situations.

We add a configuration option to modify the listen address via
the `config.ini` and set the default to `127.0.0.1`
  • Loading branch information
s-heppner committed Sep 11, 2024
1 parent 24d3a20 commit 7586713
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.ini.default
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[SERVICE]
endpoint=http://127.0.0.1
LISTEN_ADDRESS=127.0.0.1
port=8000
equivalence_table_file=./resources/equivalence_table.json

Expand Down
2 changes: 1 addition & 1 deletion semantic_matcher/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ def _get_matcher_from_semantic_id(self, semantic_id: str) -> str:
APP.include_router(
SEMANTIC_MATCHING_SERVICE.router
)
uvicorn.run(APP, host="0.0.0.0", port=int(config["SERVICE"]["PORT"]))
uvicorn.run(APP, host=config["SERVICE"]["LISTEN_ADDRESS"], port=int(config["SERVICE"]["PORT"]))

0 comments on commit 7586713

Please sign in to comment.