-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
allow dynamic updates to type mapping, update README #1319
Conversation
aec3a83
to
81dbb3c
Compare
7b538c2
to
d751225
Compare
…to the type mapping to continue functioning after update
d751225
to
79875b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, nice solution to the dynamic update problem, and overall this cleans up the code a bit (looking at it now I really didn't like how just one property from the type_mapping
object was passed to some sanitizers.
I have some thoughts on the readme wording but otherwise 👍
@@ -11,7 +11,7 @@ module.exports.middleware = (_api_pelias_config) => { | |||
size: require('../sanitizer/_size')(/* use defaults*/), | |||
layers: require('../sanitizer/_targets')('layers', type_mapping.layer_mapping), | |||
sources: require('../sanitizer/_targets')('sources', type_mapping.source_mapping), | |||
address_layer_filter: require('../sanitizer/_address_layer_filter')(type_mapping.layers_by_source), | |||
address_layer_filter: require('../sanitizer/_address_layer_filter')(type_mapping), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, this is way cleaner.
Actioned PR feedback in 091b1ff |
The original code was written with the notion that the 'type mapping' would be static, so in some cases, the
setup()
function was pre-processing the source/layer mapping in order to cache the values.This would result in incorrect behaviour for sources/layers where the new values set by
auto_discover
were not being used.This PR removes any pre-processing of the sources/layers and also uses a new function which ensures that existing pointer references are kept up-to-date.