Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: What takes priority, portal-ext.properties or the control panel ui
I was hoping that someone can explain what has the higher priority, portal-ext.properties or the control panel.
I have company.default.home.url and default.landing.page.path set in my portal-ext.properties file. But there also values in the control panel's Instance Settings page for Home URL and Default Landing Page fields. Who win's out? I want my portal-ext.properties file to win out. Do I need to leave the control panel fields blank or will they be overridden by the portal-ext.properties file.
I have company.default.home.url and default.landing.page.path set in my portal-ext.properties file. But there also values in the control panel's Instance Settings page for Home URL and Default Landing Page fields. Who win's out? I want my portal-ext.properties file to win out. Do I need to leave the control panel fields blank or will they be overridden by the portal-ext.properties file.
William Gosse:
You're out of luck, sorry: While the properties-files get read first (and even there is an order in which they're applied), anything that's configured in the database will override your precious portal-ext.properties defaults.
Who win's out? I want my portal-ext.properties file to win out.
This is actually a behavior that you probably want: Otherwise you could never configure (at runtime, without restart) any setting that you've defaulted in portal-ext.properties. Liferay will never write to the properties files, with the notable difference of portal-setup-wizard.properties once you fill out the required values.
Not only will you have to "leave the control panel fields blank", you'll have to never submit a form with configuration values to the database.
If you go to Control Panel / Server Administration / Properties, you can search for your desired properties value and see where it's coming from: Database or properties file.
The Control Panel / Server Administration / Properties / Portal Properties is telling me that company.default.home.url and default.landing.page.path are being sourced from the portal.properties file, or one of its extensions. This would seem to indicate that the portal-ext.properties file is winning. Does that make sense?
William Gosse:
It makes sense, because I've missed one aspect: Since the advent of more and more OSGi configuration, and with it the instance settings, a lot of the configuration infrastructure changed compared to before: For them, the portal-*.properties value is the default, which will initialize Liferay's configuration (consequently the database) upon first start. Then, the portal.properties value might be configured, but will be completely ignored. Thus, you don't even need to save anything in a configuration form - you just need to start up Liferay once, for the configuration to end up in the database. And the original value will never be read again (despite being available).
The Control Panel / Server Administration / Properties / Portal Properties is telling me that company.default.home.url and default.landing.page.path are being sourced from the portal.properties file, or one of its extensions. This would seem to indicate that the portal-ext.properties file is winning. Does that make sense?
I've stumbled over this too rarely to have it at the top of my mind.
I'm sorry this seems a little confusing. "And the original value will never be read again" What if I want to changes these values or am I missing the point on something here.
William Gosse:
The "original value", e.g. what you find in portal-ext.properties, is read once, on first startup and copied to the database.
I'm sorry this seems a little confusing. "And the original value will never be read again" What if I want to changes these values or am I missing the point on something here.
The database is updated through the UI.
Thus, in order to change this value, you'll need to go through the user interface.
Does this mean these instance value can only be changed through the control panel at this point.
exactly
(I've had my previous answer sitting unsubmitted in my browser for a while)
(I've had my previous answer sitting unsubmitted in my browser for a while)
Ok thanks for your help on this Olaf. It's always appreciated.
I just found a good example to illustrate the case where data is read exactly once:
The default admin settings will be used to create the administrative account upon first startup. On subsequent startups, this account is obviously no longer created - it would be quite unexpected if it were created repeatedly.
It'd be great if these values were indicating when they're read, and if they're used once (like the admin account), overridable through UI (like many settings), or used always (like the database connection, which obviously can't be stored in the database). But so far they aren't, and you'd have to use your imagination to come up with a good explanation in case something displays unexpected behavior.
The default admin settings will be used to create the administrative account upon first startup. On subsequent startups, this account is obviously no longer created - it would be quite unexpected if it were created repeatedly.
It'd be great if these values were indicating when they're read, and if they're used once (like the admin account), overridable through UI (like many settings), or used always (like the database connection, which obviously can't be stored in the database). But so far they aren't, and you'd have to use your imagination to come up with a good explanation in case something displays unexpected behavior.
William Gosse:
I was hoping that someone can explain what has the higher priority, portal-ext.properties or the control panel.
I have company.default.home.url and default.landing.page.path set in my portal-ext.properties file. But there also values in the control panel's Instance Settings page for Home URL and Default Landing Page fields. Who win's out? I want my portal-ext.properties file to win out. Do I need to leave the control panel fields blank or will they be overridden by the portal-ext.properties file.
Who wins out? It is not always clear.
Some portal-ext.properties settings are only used at first launch when the DB is being populated. Things like the default admin settings for example.
Some settings control how the node functions and those will come only from portal-ext.properties, for example setting main.servlet.https.only. These kinds of settings will not be anywhere in the database and only affect the node itself.
Rule of thumb, if you see a place to edit it in the control panel, you should edit it there.
Thanks that is helpful. So something like default.logout.page.path would have to be managed form the instance setting page in the control panel. I think this jives with what Olaf was saying as well.
Guys again thanks was able to resolve issue by modifying the values in the control panel instead the portal-ext.properties file. I'm not sure I like this but I can live with it.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™