[Geoserver-users] Parameterized data_dir

Hi all,

I was trying to use the technique explained here:

https://docs.geoserver.org/latest/en/user/community/backuprestore/configtemplate.html

but I cannot make it work. I set the host of a PG datastore to ${mypghost}, wrote a <data_dir>/geoserver-environment.properties with mypghost=localhost and then restarted with -DALLOW_ENV_PARAMETRIZATION=true but it doesn’t connect (it does when setting “localhost” directly).

Then I tried to remove the geoserver-environment.properties file and set the logging level to verbose but I don’t see this message in the logs anywhere:

https://github.com/geoserver/geoserver/blob/master/src/platform/src/main/java/org/geoserver/platform/GeoServerEnvironment.java#L104

https://github.com/geoserver/geoserver/blob/master/src/platform/src/main/java/org/geoserver/platform/GeoServerEnvironment.java#L120

It seems like the bean is never initialized. Do I need to configure something else to enable this feature?

Thanks in advance.

···

Víctor González

http://geomati.co

Hi,

your configuration look good, did you install the Backup & Restore module ?
https://docs.geoserver.org/latest/en/user/community/backuprestore/installation.html

Regards,

Nuno Oliveira

···

Víctor González

http://geomati.co

Hi,

Yes, I did. Although I found that the GeoServerEnvironment class is in the platform project and Alessio suggested that the extension is not necessary:
http://osgeo-org.1560.x6.nabble.com/spring-PropertyPlaceholderConfigurer-for-data-directory-files-tp5313190p5313197.html

I’ll try to do it again with a fresh installation; maybe there’s something messed up with my current setup.

Cheers.

···

Víctor González

http://geomati.co

Hello,

Just for completeness, my infrastructure was quite complex with multiple components, etc. and the problem was that the -DALLOW_ENV_PARAMETRIZATION property was not arriving to GeoServer. It’s working perfectly now!

Sorry for bothering.

···

Víctor González

http://geomati.co

Great ! thx for the feedback.

···

Víctor González

http://geomati.co