-
Notifications
You must be signed in to change notification settings - Fork 204
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
Allow name of session and moqui.visitor cookie to be configured. moqu… #305
base: master
Are you sure you want to change the base?
Conversation
…i.visitor cookie name can be changed by system property moqui_visitor_cookie_name, while session cookie name JSESSIONID can be configured by webapp.session-config.@cookie-name in MoquiConf.xml
|
@jonesde Hi David, do you have any comment on this PR? |
I will sooner or later, have bigger fish to fry (more significant issues to handle). From a quick read through this is wrong (in UserFacadeImpl): visitorCookieName = System.getProperty("moqui_visitor_cookie_name") To use a system property through the Moqui Conf XML file there should be a placeholder in the file with the property name, and the code should get the value from the MNode that came from the parsing the XML file and expanding placeholders (in ${}) against system or default property settings. |
Sure, no problem when you have time on reviewing this. I have |
Just looked at this again and in UserFacadeImpl it still gets the cookie name directly from a system property which breaks the pattern of being able to set it in the Moqui Conf XML file (which can in turn get it from the system property), ie this on line 74 of your patched version:
This should be changed to look at the webapp.session-config.@cookie-name attribute that you added. In the MoquiDefaultConf.xml file instead of this:
you would need this to pick up the system property or JVM param:
|
Wait, looking at this again it looks like you're actually trying to do 2 different cookie names, the session cookie name and the visitorId cookie name. Both should be handled the same way, ie following the pattern of what I commented on last but we'll need 2 attributes in the Moqui Conf XML file and 2 property names to expand from. It would be better to name these more distinctly too, ie 'session-cookie-name' along with moqui_session_cookie_name and 'visitor-cookie-name' along with moqui_visitor_cookie_name. |
I understand the comments, here is my thought:
|
for comment
for visitor cookie, it is already named |
Why make it more complicated by using different patterns for configuring different things? All it does is make configuration for users more difficult, and documentation look odd because to properly explain how to do this and that it would have to clarify the differences. IMO the moqui_ prefix should be removed as it also breaks the pattern used with other properties. I'm not so worried about property collisions (they I often do a quick google search on candidate property names for potential conflicts). Usually System properties are used only when Moqui is deployed in something like a container where it is the only thing running, and for more custom bare metal deployments usually Java env vars or actual Moqui Conf XML files are more convenient. |
OK. I will make a change that remove BTW, is it right that I use System.getProperty('visitor_cookie-name') as environment variable overrides moqui conf property |
And I name it as |
…i.visitor cookie name can be changed by system property moqui_visitor_cookie_name, while session cookie name JSESSIONID can be configured by webapp.session-config.@cookie-name in MoquiConf.xml