Merge pull request #377 from orangemug/fix/glyphs-for-tilehosting

Updated regex to tilehosting.com
This commit is contained in:
Orange Mug
2018-09-03 21:15:01 +01:00
committed by GitHub

View File

@@ -92,9 +92,6 @@ function replaceSourceAccessToken(mapStyle, sourceName, opts={}) {
...mapStyle,
sources: changedSources
}
if (mapStyle.glyphs) {
changedStyle.glyphs = changedStyle.glyphs.replace('{key}', accessToken)
}
return changedStyle
}
@@ -105,6 +102,13 @@ function replaceAccessTokens(mapStyle, opts={}) {
changedStyle = replaceSourceAccessToken(changedStyle, sourceName, opts);
})
if (mapStyle.glyphs && mapStyle.glyphs.match(/\.tilehosting\.com/)) {
changedStyle = {
...changedStyle,
glyphs: mapStyle.glyphs.replace('{key}', getAccessToken("openmaptiles", mapStyle, opts))
}
}
return changedStyle
}