RE: What takes priority, portal-ext.properties or the control panel ui

thumbnail
William Gosse, modified 6 Years ago. Liferay Master Posts: 533 Join Date: 7/4/10 Recent Posts
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.
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
William Gosse:

Who win's out? I want my portal-ext.properties file to win out.
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.
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.
thumbnail
William Gosse, modified 6 Years ago. Liferay Master Posts: 533 Join Date: 7/4/10 Recent Posts
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?
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
William Gosse:

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?
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).
I've stumbled over this too rarely to have it at the top of my mind.
thumbnail
William Gosse, modified 6 Years ago. Liferay Master Posts: 533 Join Date: 7/4/10 Recent Posts
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.
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
William Gosse:

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 "original value", e.g. what you find in portal-ext.properties, is read once, on first startup and copied to the database.
The database is updated through the UI.
Thus, in order to change this value, you'll need to go through the user interface.
thumbnail
William Gosse, modified 6 Years ago. Liferay Master Posts: 533 Join Date: 7/4/10 Recent Posts
Does this mean these instance value can only be changed through the control panel at this point.
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
exactly

(I've had my previous answer sitting unsubmitted in my browser for a while)
thumbnail
William Gosse, modified 6 Years ago. Liferay Master Posts: 533 Join Date: 7/4/10 Recent Posts
Ok thanks for your help on this Olaf. It's always appreciated.
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
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.
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
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.
thumbnail
William Gosse, modified 6 Years ago. Liferay Master Posts: 533 Join Date: 7/4/10 Recent Posts
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.
thumbnail
William Gosse, modified 6 Years ago. Liferay Master Posts: 533 Join Date: 7/4/10 Recent Posts
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.