Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make tileserver endpoint accessible to third party hosts (may need to reconsider the "security" of this endpoint and what we want) - @ryangroth5 #570

Open
Tracked by #566
tallowen opened this issue Aug 2, 2023 · 5 comments
Assignees

Comments

@tallowen
Copy link
Member

tallowen commented Aug 2, 2023

No description provided.

@ngottlieb
Copy link
Contributor

The tileserver is currently implemented by this SQL query in this Laravel controller:

https://github.com/AmericanWhitewater/wh2o/blob/development/app/Http/Controllers/API/TilesController.php

Worth noting (so that you don't bang your head against the wall) that it may require some functions that are created in PostGIS using this mapbox library. It did at one point, I'm not 100% sure now.


On the front-end, this tileserver endpoint is used anywhere we use the VUE_APP_NWI_TILE_SERVE environment variable. That's loaded into environment.nwiTileServer -- grepping "nwiTileServer" should get you the most up-to-date listing of where it's used. As of now, it's only actually used in the nwiMap component (which is reused in a number of places throughout the site):

https://github.com/AmericanWhitewater/wh2o-vue/blob/development/src/app/views/river-index/components/nwi-map.vue

@ngottlieb
Copy link
Contributor

Also just to reiterate: the security concerns that led to the access control we currently have are only about our own data, not access to Mapbox or ESRI using our API tokens (both are whitelisted to AW domains so can't be stolen). Our main impetus was, and I think continues to be, to prevent someone like, say, a river outfitter turned app developer, from using our data without asking or reaching some kind of licensing agreement.

@ngottlieb
Copy link
Contributor

@drewalth there may be some overlap between this and what you're working on given that both tasks involve connecting some serverless architecture to our existing DB

@tallowen
Copy link
Member Author

tallowen commented Aug 11, 2023

I created an endpoint: https://tileserver.americanwhitewater.org

That hits the following code:
https://github.com/AmericanWhitewater/aw-components/tree/main/js-packages/tileserver

There are a couple key things that we need to do with this code:

  1. Get a prisma client going so that we can more easily query data
  2. Actually write the endpoint to return the data
  3. Configure cors etc with the serverless framework (I believe this should be easy enough)

@tallowen
Copy link
Member Author

https://tileserver.americanwhitewater.org/ now returns data fetched by prisma and backed by the database. I believe the next step is just to add to the queries and return the correct data.

@ngottlieb ngottlieb self-assigned this Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants