catalog-backend: add support for static location config + bootstrap location #1890
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1833
Tried 3 different implementations of this, this is the least ugly one ._.
So this adds a processor that reads a
'bootstrap'
location, of which there always exists one, and it can be used to bootstrap other work.I tried implementing this as a decorator for the
LocationCatalog
, as you can do more validation of that locations are allowed to be added with that. But that falls apart because the locations aren't added to the database, and entities has a foreign key constraint on the location id.Another option was to do something similar to this, but use a statically added location entity instead. This felt slightly more clean though.
Overall I ran into a bunch of issues because of the existence of
LocationId
s, and would want to explore if we could completely promote all kinds of locations to entities, and then also get rid of the IDs.I also noticed the slightly awkward fact that it's the registered location in the database that shows up as the
managed-by
location, even when emitting a location entity that is then read to collect more entities. It's again due to the location id being a requirement, and emitted locations don't receive any ID.