Skip to content
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

Provide a better way for users to modify hawtconfig.json #2604

Closed
tadayosi opened this issue Oct 28, 2019 · 10 comments
Closed

Provide a better way for users to modify hawtconfig.json #2604

tadayosi opened this issue Oct 28, 2019 · 10 comments

Comments

@tadayosi
Copy link
Member

See: #2603

Currently users need to unzip hawtio.war and pack it again to modify hawtconfig.json:
https://access.redhat.com/documentation/en-us/red_hat_fuse/7.4/html/managing_fuse/manage-monitor-fuse-karaf#fuse-console-branding-karaf

There should be a more sophisticated way for users to customise the configurations.

@abkieling
Copy link
Contributor

@tadayosi I think we could leverage the existing io.hawt.system.ConfigManager class to customize hawtconfig.json. It supports both System properties and JNDI, right? We could either create a single property pointing to an external version of hawtconfig.json or multiple properties customizing specific fields. Customizing images is a bit tricky because the new image would need to be placed inside the hawtio jar/war or served by an external Web server.

@tadayosi
Copy link
Member Author

@akieling That's an idea, but hawtconfig.json is also read from hawtio-core so we might need to find a way to influence the front-end component hawtio-core from the server-side config properties.

Another option might be to use the custom plugin mechanism:
https://github.com/hawtio/hawtio/blob/master/examples/simple-plugin/src/main/webapp/plugin/simplePlugin.js
and invoke hawtioPluginLoader.registerPreBootstrapTask() there to let users directly modify window['hawtconfig'] programmatically. ... Wait, it sounds like it's already possible?

The Login component doesn't share the same code with hawtio-core config-loader.ts so we have to modify it to fully support the way anyway, though.
https://github.com/hawtio/hawtio/blob/hawtio-2.8.0/hawtio-console-assembly/app/src/login/login.component.ts#L21-L29

@tadayosi
Copy link
Member Author

Note also that hawtio-online and hawtio-operator depend on hawtconfig.json as well. I'm not sure if the current custom plugin mechanism works well with hawtio-online & hawtio-operator, and if there's even need for customising hawtconfig.json. But I assume it's just a matter of modifying the hawtconfig.json config map so it's already sophisticated enough on OpenShift? @astefanutti WDYT?

@astefanutti
Copy link
Contributor

@tadayosi yes, hawtio-online relies on hawtconfig.json as a config map. If hawtio-operator is used to deploy Hawtio Online, the operator watches changes to the config map and automatically triggers a rolling update, so that the changes are taken into account automatically.

@abkieling
Copy link
Contributor

@tadayosi Let me just share an alternative idea. What about creating a Servlet filter that intercepts the request to hawtconfig.json and customizes it before it gets sent back to the browser? The customization values would come from a file on disk, System variables, environment variables, etc.

@tadayosi
Copy link
Member Author

tadayosi commented Nov 5, 2019

@akieling That sounds good too. Let's provide both ways then. By the way, another thing the custom plugin approach is good at is that the custom plugin provides a place to put other brand related resources such as images and css. The system properties approach might be easier for users but it seems to be still awkward for providing the brand related resources.

Is there anything you're concerned about the custom plugin approach? Such as security issues, and so on?

@abkieling
Copy link
Contributor

@tadayosi No concerns at all. You know better than me what type of customization the customers want to do. If they want to change images, then the system properties approach loses some of its benefits due to the need to serve the images from somewhere else or unzip Hawtio to add the images.

tadayosi added a commit that referenced this issue Dec 2, 2019
…ication

This illustrates how you can customise hawtconfig.json in a SB
application. #2604
tadayosi added a commit to tadayosi/hawtio that referenced this issue Dec 5, 2019
tadayosi added a commit that referenced this issue Dec 5, 2019
@tadayosi
Copy link
Member Author

tadayosi commented Dec 9, 2019

My branding-plugin looks ok for the purpose:
https://github.com/hawtio/hawtio/tree/master/examples/branding-plugin
so let me close this issue.

Alex's idea of using a ServletFilter is recorded to #2609.

@tadayosi tadayosi closed this as completed Dec 9, 2019
@osmanates
Copy link

Sorry to revive an old thread. But i couldn't make it work with a spring boot jar project. Where do i need to put my customized hawtconfig.json file in a spring boot jar to make it work?

@tadayosi
Copy link
Member Author

tadayosi commented Jun 5, 2020

@osmanates Can you file a new issue for your question? I'm willing to help you there. First you can check this example btw: https://github.com/hawtio/hawtio/tree/hawtio-2.10.0/examples/springboot-authentication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants