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

accesToken in config not passed through to app #161

Open
eveostay opened this issue Feb 25, 2016 · 2 comments
Open

accesToken in config not passed through to app #161

eveostay opened this issue Feb 25, 2016 · 2 comments
Labels

Comments

@eveostay
Copy link

In our local flavor's config.yml I have

layers:
    - type: mapbox
      style: mapbox://styles/[actual string removed]
      accessToken: [actual string removed]

But, the accessToken wasn't being passed through, resulting in the error L.mapboxGL is not a function.

The workaround was to add the token string to the settings.py:

+MAPBOX_TOKEN = env.get('MAPBOX_TOKEN', '[string]')

@modulitos
Copy link
Contributor

You can see where the Django template checks the token and loads the library here: https://github.com/openplans/shareabouts/blob/master/src/sa_web/templates/base.html#L140-L144 I think this is by design to avoid loading the mapbox-gl-js library unnecessarily.

I believe the accessToken: attribute in the config is used only when you want to override the access token in your environment variable for a particular layer.

Perhaps this design could be more explicit. Ideally, I imagine a solution that loads modules dynamically, by using RequireJS. It seems like it would be a significant refactor, but worth it!

@fkh fkh added the bug label Mar 8, 2016
@BenSturmfels
Copy link
Contributor

Agreed, this is a little akward the way that MAPBOX_TOKEN is required for the Mapbox JS to be loaded. The docs in CONFIG.md don't really explain this properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants