Skip to content

Commit 0890c71

Browse files
committed
refactor: _load_legacy_wsgi now internally resolves its config file path instead of receiving it as an argument.
1 parent 406e767 commit 0890c71

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

openlibrary/asgi_app.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def wrapper(environ, start_response):
3434
return wrapper
3535

3636

37-
def _load_legacy_wsgi(ol_config_file: str):
37+
def _load_legacy_wsgi():
3838
"""Initialize legacy configuration and side-effects as in scripts/openlibrary-server.
3939
4040
This function does not return a WSGI callable; it is called for its side effects only.
@@ -45,6 +45,9 @@ def _load_legacy_wsgi(ol_config_file: str):
4545
# match scripts/openlibrary-server behavior
4646
from infogami.utils import delegate as _delegate # noqa: F401 - side-effects
4747

48+
ol_config_path = Path(__file__).parent / "conf" / "openlibrary.yml"
49+
ol_config_file = os.environ.get("OL_CONFIG", str(ol_config_path))
50+
4851
config.plugin_path += ["openlibrary.plugins"]
4952
config.site = "openlibrary.org"
5053

@@ -121,11 +124,9 @@ def create_app() -> FastAPI:
121124

122125
pytest.skip("Skipping in CI", allow_module_level=True)
123126

124-
ol_config_path = Path(__file__).parent / "conf" / "openlibrary.yml"
125-
ol_config = os.environ.get("OL_CONFIG", str(ol_config_path))
126127
try:
127128
# We still call this even though we don't use it because of the side effects
128-
legacy_wsgi = _load_legacy_wsgi(ol_config) # noqa: F841
129+
_load_legacy_wsgi()
129130

130131
global sentry
131132
if sentry is not None:

0 commit comments

Comments
 (0)