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

Put api keys directly in js layer definitions #5352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AntonKhorev
Copy link
Collaborator

Currently map layer API keys have one extra level of indirection:

  • keys are defined in the settings
  • osm.js.erb reads them from the settings and writes them to OSM.THUNDERFOREST_KEY and OSM.TRACESTRACK_KEY
  • layers.yml contain names of OSM properties to check for keys

Instead of this osm.js.erb could write keys directly to layer definitions, skipping OSM.THUNDERFOREST_KEY and OSM.TRACESTRACK_KEY. layers.yml could contain the corresponding settings names. The advantage is that Thunderforest and Tracestrack keys are no longer special. A new key can be added just by editing settings.yml and layers.yml. Also it's possible to skip layer definitions if they require a key and that key is missing.

@tomhughes
Copy link
Member

I'm sure this could be improved, but a massive multi line block of ruby embedded is a js file is definitely not the answer to my mind at least.

@AntonKhorev AntonKhorev force-pushed the map-layer-configuration-api-keys branch from 25279c4 to 37ce56f Compare November 24, 2024 15:57
@AntonKhorev
Copy link
Collaborator Author

I moved that ruby code to a module, but now there's no dependency on it. If it's changed, osm.js won't be recompiled.

@AntonKhorev AntonKhorev force-pushed the map-layer-configuration-api-keys branch from 37ce56f to 32d95eb Compare December 9, 2024 11:36
Also don't generate definitions for layers that have require missing api keys.
@AntonKhorev AntonKhorev force-pushed the map-layer-configuration-api-keys branch from 32d95eb to 7571bdf Compare December 9, 2024 11:48
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

Successfully merging this pull request may close these issues.

2 participants