Closed nuest closed 3 years ago
I identified a way how we could archive that.. However, it was not possible to create a JSON File. The problem is that until the JS in the HTML loads the JSON File, the React App already crashes.
I have created a config.js
https://github.com/NJaku01/o2r-UI/blob/ojsVIew/ui/public/config.js, which stays untouched during the build. This file can then be changed. I added already that the Erc Id and ojsView have to be set in this config.js. The config.js
is indeed loaded into the index.html
.
What are your opinions to this approch?
Full commit overview: https://github.com/NJaku01/o2r-UI/commit/7bd1cbe4f1532eeb18b3a9ad089599193f5c539d
Looks good to me!
So is it then the idea that also the OJS plugin only adjusts the values in the config.js, and this script is then loaded by the HTML, i.e. in the OJS galley?
Yes, right. In the new build (https://github.com/NJaku01/o2r-UI/releases/download/0.4.0/build.zip) there is a index.html and a config.js. You must include the complete folder and can load the index.html in the OJS galley. You can then adjust the config.js or even replace it completely. However the variables baseUrl, ercURl and title have to be defined.
We need a way to configure the server endpoint for the production build, too. So in a way similar to the standalone HTML we discussed for OJS today.
Before the build, we had a
config.json
file, see https://github.com/o2r-project/ansible/blob/master/provisioning/roles/docker-ui/templates/config.json.j2The values are taken from this configuration file: https://github.com/o2r-project/ansible/blob/master/provisioning/host_vars/ubsvirt148.uni-muenster.de/vars.yml
@NJaku01 @Fmazin Can you please take a look and decide how to proceed? Ideally the values are taken form an external
.json
file that is loaded intoindex.html
, because that is easier to configure on the server than replacing a chunk within the HTML file (so what we decided @tnier01 will do for the OJS plugin).If an external config JSON file is possible, maybe that should also be the way then for OJS?