Skip to content

Commit d4d2494

Browse files
committed
service: Add option to modify listen address
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`
1 parent e2b94e9 commit d4d2494

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

config.ini.default

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[SERVICE]
22
endpoint=http://127.0.0.1
3+
LISTEN_ADDRESS=127.0.0.1
34
port=8000
45
equivalence_table_file=./resources/equivalence_table.json
56

semantic_matcher/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@ def _get_matcher_from_semantic_id(self, semantic_id: str) -> str:
180180
APP.include_router(
181181
SEMANTIC_MATCHING_SERVICE.router
182182
)
183-
uvicorn.run(APP, host="0.0.0.0", port=int(config["SERVICE"]["PORT"]))
183+
uvicorn.run(APP, host=config["SERVICE"]["LISTEN_ADDRESS"], port=int(config["SERVICE"]["PORT"]))

0 commit comments

Comments
 (0)