hotosm / galaxy-api

Backend to fetch data from Underpass
https://galaxy-api.hotosm.org/latest/redoc
GNU Affero General Public License v3.0
14 stars 5 forks source link

Generate Absolute Download URL by reading from Request : Rawdata #190

Closed kshitijrajsharma closed 2 years ago

kshitijrajsharma commented 2 years ago

Currently Raw data endpoint gets hosting URL and port from config , which is not very friendly and good way to do this. Plan is to get hosting URL and port from request URL so that we can avoid unnecessary config block and Endpoint can generate absolute download URL in any environment

ramyaragupathy commented 2 years ago

@itskshitiz321 - can you please expand on hosting URL and port information? It is unclear if you are related to DB or the requesting client or something specific to API.

kshitijrajsharma commented 2 years ago

It is about generating Download URL for file download ! It is not related with any DB information , for eg : Let's say we have hosted API in galaxy.hotosm.org , now when user is accessing endpoint they will be redirected to galaxy.hotosm.org/rawdata/current-snapshot , now when delivering file to user API need to provide absolute URL to user that means url should be https://galaxy.hotosm.org/rawdata/filename . Now while getting request from user : plan is to grab url and port from request itself , in that way even when API is hosted on staging setup or different url or is in localsetup it will still work and bind the file back to user . Previously I was storing those host and port information in config.txt file , now plan is to grab them from request itself so that we will get rid of config block and API can adapt itself wrt hosting url and port for generating downloadable absolute URL for rawdata processed file ! @ramyaragupathy

ramyaragupathy commented 2 years ago

Thanks for explaining @itskshitiz321 - it is clear now 💯