kuhumcst / korp-setups

Docker setups for all Korp installations maintained by NorS.
MIT License
1 stars 0 forks source link

Re-establish dynamic loading of KORP frontend config files #7

Closed simongray closed 3 years ago

simongray commented 3 years ago

It used to be the case in the old KORP installation that people - e.g. Dorte - could manually edit the frontend config files, have it reload automatically, and use that as a quick feedback mechanism when developing a new KORP corpora setup. While this is not exactly a desirable property to have in a live production system, this is her desired workflow and we should work to support it. In the future, when she has a fully local installation on her computer, she (and others) will be happy to have this functionality there as well.

I speculate that the reason that the current KORP installation doesn't support is has to do with the fact that I ignore the run_config.json file entirely, preferring to simply patch the KORP frontend file structure directly as that provided me with patch access to the entirety of the KORP frontend codebase, as opposed to just the files allowed through a run_config.json file. A hybrid solution where patching happens, but the run_config.json also exists might be deliver the best of both worlds.

simongray commented 3 years ago

After spending more than a full day's work trying to figure out run_config.json I have discovered that it basically offers nothing over the existing copy-in-place approach. It is run exactly once - during compilation - so the naming really makes no sense. I am beginning to suspect that someone at Språkbanken thinks runtime is the same as compile time. In a JS setting, runtime would be when the app is run in the browser, not when the JS bundle is being compiled.

Anyway, I discovered that the dist/ folder created internally in the Docker container during the compilation step contains a translations and a modes directory (as well as markup and lib which don't care about). Files can be dynamically reloaded by copying them into these folders. In order to allow Dorte to edit modes I should put a script inside the docker container that she can run using docker-compose exec and this script should simply copy app/translations and app/modes into dist in order to sync the changes.

One issue is that this won't allow her to edit settings.modeConfig in config.js.

simongray commented 3 years ago

Accidentally included run_config.json bits that should have been left out. Removed again in c15ecfb36e3170b6f32d7dd2fd30d332db57d76b