mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 13:54:07 +00:00
allow to add php-compatible endpoints
If the new setting NOMINATIM_SERVE_LEGACY_URLS is set, the servers expose the endpoints also with the .php suffix to ensure backwards compatibility.
This commit is contained in:
@@ -62,7 +62,11 @@ def get_application(project_dir: Path,
|
||||
from sanic_cors import CORS # pylint: disable=import-outside-toplevel
|
||||
CORS(app)
|
||||
|
||||
legacy_urls = app.ctx.api.config.get_bool('SERVE_LEGACY_URLS')
|
||||
for name, func in api_impl.ROUTES:
|
||||
app.add_route(_wrap_endpoint(func), f"/{name}", name=f"v1_{name}_simple")
|
||||
endpoint = _wrap_endpoint(func)
|
||||
app.add_route(endpoint, f"/{name}", name=f"v1_{name}_simple")
|
||||
if legacy_urls:
|
||||
app.add_route(endpoint, f"/{name}.php", name=f"v1_{name}_legacy")
|
||||
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user