-
Notifications
You must be signed in to change notification settings - Fork 95
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
Load config from URL #1252
base: skosmos-2
Are you sure you want to change the base?
Load config from URL #1252
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
Didn't test, but change looks good to me. If the env var is specified, we replace the config name. In that case we don't use the cache and parse the config directly. When parsing it, the config is fetched via curl
, which is already a requirement of Skosmos.
@@ -107,9 +122,18 @@ private function initializeConfig() | |||
*/ | |||
private function parseConfig($filename) | |||
{ | |||
if (str_starts_with($filename, self::HTTP_URL_PREFIX) || str_starts_with($filename, self::HTTPS_URL_PREFIX)) { |
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.
Maybe we could modify parseConfig
to pass a flag telling it whether it is a local config, or a remote config? This way we wouldn't have to check if it starts with http
or https
here and in the caller function ☝️
Thanks for the PR and sorry for the slow response. This is a good feature (both introducing the environment variable and allowing URLs to be used instead of filenames) and IIRC something like this has been requested by other users as well in the past although I forget the details. I'm worried about the performance. Parsing the config file can be a very expensive operation, tens or hundreds of milliseconds, and if there is no caching on the Skosmos side, then both URL retrieval and parsing has to be done each time a page is being generated - sometimes several times when the page performs AJAX style queries or accesses the REST API, for example on the vocabulary home page. The cache seems to be bypassed now in case a URL is given. Although this is not a regression in a strict sense (previously it wasn't possible to use a config URL at all, now it's possible but potentially very slow), I don't think this is an ideal solution. I can see two possible improvements:
I'd go for 2, since it's a lot simpler. It would still be possible to implement option 1 later, if necessary. |
Reasons for creating this PR
Enable the creation of a reusable (deployment-agnostic) docker container.
Link to relevant issue(s), if any
Description of the changes in this PR
Known problems or uncertainties in this PR
Checklist
As there are a large number of outstanding PRs, I'm loath to spend time beyond my immediate needs on stuff that may just end up going nowhere.