Merge pull request #388 from orangemug/fix/glyph-key-replace

Fix glyph key replace
This commit is contained in:
Orange Mug 2018-09-22 15:50:12 +01:00 committed by GitHub
commit 9c07852b87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,9 +102,12 @@ function replaceAccessTokens(mapStyle, opts={}) {
}) })
if (mapStyle.glyphs && mapStyle.glyphs.match(/\.tilehosting\.com/)) { if (mapStyle.glyphs && mapStyle.glyphs.match(/\.tilehosting\.com/)) {
changedStyle = { const newAccessToken = getAccessToken("openmaptiles", mapStyle, opts);
...changedStyle, if (newAccessToken) {
glyphs: mapStyle.glyphs.replace('{key}', getAccessToken("openmaptiles", mapStyle, opts)) changedStyle = {
...changedStyle,
glyphs: mapStyle.glyphs.replace('{key}', newAccessToken)
}
} }
} }