Skip to content

Commit

Permalink
Allow configuration of service address (#143)
Browse files Browse the repository at this point in the history
* Allow configuration of service address with FC_HOST
  • Loading branch information
blinkdog authored Mar 28, 2023
1 parent 72c8d40 commit 52d29a3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions file_catalog/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class Config(Dict[str, Optional[Union[bool, int, str]]]):
'FC_COOKIE_SECRET': ConfigParamSpec(
None, str, 'Value of cookie_secret argument for tornado.web.Application'
),
'FC_HOST': ConfigParamSpec(
'localhost', str, 'Address for File Catalog server to bind for listening (default: localhost)'
),
'FC_PORT': ConfigParamSpec(
8888, int, 'Port for File Catalog server to listen on'
),
Expand Down
3 changes: 2 additions & 1 deletion file_catalog/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ def create(config: Dict[str, Any],
server.add_route(r"/api/snapshots/([^\/]+)", SingleSnapshotHandler, args) # type: ignore[no-untyped-call] # noqa: E221, E241, E251
server.add_route(r"/api/snapshots/([^\/]+)/files", SingleSnapshotFilesHandler, args) # type: ignore[no-untyped-call] # noqa: E221, E241, E251

address = config["FC_HOST"]
port = config["FC_PORT"]
server.startup(port=port) # type: ignore[no-untyped-call]
server.startup(address=address, port=port) # type: ignore[no-untyped-call]

return server

Expand Down
12 changes: 6 additions & 6 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ coverage[toml]==7.2.2
# via pytest-cov
crawler==0.0.2
# via wipac-file-catalog (setup.py)
cryptography==40.0.0
cryptography==40.0.1
# via pyjwt
deprecated==1.2.13
# via opentelemetry-api
Expand All @@ -50,7 +50,7 @@ googleapis-common-protos==1.56.2
# via
# opentelemetry-exporter-jaeger-proto-grpc
# opentelemetry-exporter-otlp-proto-http
grpcio==1.51.3
grpcio==1.53.0
# via opentelemetry-exporter-jaeger-proto-grpc
humanfriendly==10.0
# via coloredlogs
Expand Down Expand Up @@ -170,13 +170,13 @@ tornado==6.2
# wipac-rest-tools
types-cryptography==3.3.23.2
# via pyjwt
types-pymysql==1.0.19.5
types-pymysql==1.0.19.6
# via wipac-file-catalog (setup.py)
types-python-dateutil==2.8.19.10
types-python-dateutil==2.8.19.11
# via wipac-file-catalog (setup.py)
types-requests==2.28.11.16
types-requests==2.28.11.17
# via wipac-file-catalog (setup.py)
types-urllib3==1.26.25.8
types-urllib3==1.26.25.10
# via types-requests
typing-extensions==4.5.0
# via
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ coloredlogs==15.0.1
# via
# wipac-file-catalog (setup.py)
# wipac-telemetry
cryptography==40.0.0
cryptography==40.0.1
# via pyjwt
deprecated==1.2.13
# via opentelemetry-api
googleapis-common-protos==1.56.2
# via
# opentelemetry-exporter-jaeger-proto-grpc
# opentelemetry-exporter-otlp-proto-http
grpcio==1.51.3
grpcio==1.53.0
# via opentelemetry-exporter-jaeger-proto-grpc
humanfriendly==10.0
# via coloredlogs
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ async def rest(monkeypatch: MonkeyPatch, mongo: Mongo, port: int) -> AsyncGenera
config: Dict[str, Any] = {
"AUTH_AUDIENCE": "file-catalog-testing",
"AUTH_OPENID_URL": "https://keycloak.icecube.wisc.edu/auth/realms/IceCube",
"FC_HOST": "localhost",
"FC_PORT": port,
"FC_PUBLIC_URL": f"http://localhost:{port}",
"FC_QUERY_FILE_LIST_LIMIT": 10000,
Expand Down

0 comments on commit 52d29a3

Please sign in to comment.