-
Notifications
You must be signed in to change notification settings - Fork 0
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
Config: Override backend locations on localhost #12
base: config/master
Are you sure you want to change the base?
Conversation
@Traubert, @mmatthiesencsc, @aajarven: What do you think: is it ok to specify localhost backend locations in the frontend configuration like this, in particular as they are specific to my own local Korp installation? |
Personally I'd control this in the deployment process, rather than code, with eg. Jinja2 templates in Ansible. We could make an example of this / point you to something in Kielipankki-korp-ansible? |
@Traubert, I suppose that would in general be a better solution, although I don’t know exactly how it would be implemented in this case. I mostly run Korp locally via webpack-dev-server ( I’d like to be able to use the same code as in production without having to make temporary changes with a risk of accidentally committing to the production code. Maybe we could have for the locations a separate file that wouldn’t be version-controlled, but how would the information in it be read to or otherwise incorporated into In any case, I wouldn’t like to make any significant modifications to this Korp version to support this kind of configuration, as it’ll have to be changed in the next version anyway. |
Jyrki, I suggest to indeed have locations in a separate file and the production code checks for that file and reads the contents if present. That way I think we get the best of both worlds and are very flexible. |
@mmatthiesencsc, I agree in principle. However, it’s not obvious to me how you would do that in JavaScript, and I wouldn’t like to spend much time in trying to figure that out, so I’d be grateful for an example. Maybe I’ll try to make do with modifying |
yarn seems to have distinction between dev and prod:
maybe add |
Override backend locations (
settings.korpBackendURL
,settings.downloadCgiScript
) to point to localhost locations when the frontend is running on localhost. This makes it possible to use the configuration file without modifications both in production and when testing locally.A problem with this solution is that the exact localhost backend locations are those used by me (@janiemi): someone else might use different locations. However, I don’t know if someone else currently runs Korp locally, and this was the easiest solution I came up with to make it possible to use the configuration file also locally without modifications.