Hi Christophe

Here's a quick hack to convert from PostGIS to PostGIS (JNDI), if you want
to try it.  It works for me.

Assumption: you have read/write server access to the configuration
directory GEOSERVER_DATA_DIR

cd GEOSERVER_DATA_DIR/workspaces/<workspace>/<datastore>
edit the file datastore.xml
change line 5 from
<type>PostGIS</type>
->
<type>PostGIS (JNDI)</type>
add a new line within <connectionParameters>:
<entry key="jndiReferenceName">java:comp/env/jdbc/*jndi*</entry>
(replacing jndi with the correct string)
restart GeoServer and verify the new datastore in the GUI

hth

Peter

GeoServer PSC
AWS Solutions Architect
https://github.com/petersmythe


On Tue, 20 Feb 2024 at 16:16, <christophe.garault....@orange.com> wrote:

> Thanks Jody and Graham, it works fine and it’s well documented. That is
> exactly what I was looking for.
>
>
>
> Now I need to figure out how to move all the already published layers from
> the old postgis datastore to the new JNDI one since it’s the same database.
> I guess moving the content of the directory will not be sufficient. Maybe
> changing the datastore Id in each layer would do the job ?
>
>
>
>
>
> Regards,
>
> —
> *Christophe GARAULT *
>
>
>
> *De :* Jody Garnett <jody.garn...@gmail.com>
> *Envoyé :* mardi 20 février 2024 03:53
> *À :* GARAULT Christophe Ext DTSI/DTR <christophe.garault....@orange.com>
> *Cc :* geoserver-users@lists.sourceforge.net
> *Objet :* Re: [Geoserver-users] How to parameterize password of a
> datastore ?
>
>
>
> I would recommend JNDI, define the database in tomcat by name and
> reference it in geoserver config.
>
> --
>
> Jody Garnett
>
>
>
>
>
> On Mon, Feb 19, 2024 at 7:46 AM <christophe.garault....@orange.com> wrote:
>
> Hi all,
>
>
>
> Is there a way to parameterize the password field of a datastore as with
> others fields as shown in the doc (
> https://docs.geoserver.org/latest/en/user/datadirectory/configtemplate.html
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.geoserver.org%2Flatest%2Fen%2Fuser%2Fdatadirectory%2Fconfigtemplate.html&data=05%7C02%7Cchristophe.garault.ext%40orange.com%7Cc18668014b3a4f019d9d08dc31bf27d2%7C90c7a20af34b40bfbc48b9253b6f5d20%7C0%7C0%7C638439944279967192%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=XOAHv9IgFUooFdg%2FpEc%2F8dSFXlxBUQyCuxEinURqMao%3D&reserved=0>
> )
>
> We have several environments which doesn’t necessarily have the same
> password.
>
>
>
> I tried to set something like this without any success in the properties
> file:
>
> database.passwd=crypt1:xxxxxxx
>
>
>
>
>
>
>
> Thanks in advance
>
>
>
> Regards,
>
> —
> *Christophe GARAULT*
>
> ____________________________________________________________________________________________________________
>
> Ce message et ses pieces jointes peuvent contenir des informations 
> confidentielles ou privilegiees et ne doivent donc
>
> pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu 
> ce message par erreur, veuillez le signaler
>
> a l'expediteur et le detruire ainsi que les pieces jointes. Les messages 
> electroniques etant susceptibles d'alteration,
>
> Orange decline toute responsabilite si ce message a ete altere, deforme ou 
> falsifie. Merci.
>
>
>
> This message and its attachments may contain confidential or privileged 
> information that may be protected by law;
>
> they should not be distributed, used or copied without authorisation.
>
> If you have received this email in error, please notify the sender and delete 
> this message and its attachments.
>
> As emails may be altered, Orange is not liable for messages that have been 
> modified, changed or falsified.
>
> Thank you.
>
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ianturton.com%2Ftalks%2Ffoss4g.html%23%2F&data=05%7C02%7Cchristophe.garault.ext%40orange.com%7Cc18668014b3a4f019d9d08dc31bf27d2%7C90c7a20af34b40bfbc48b9253b6f5d20%7C0%7C0%7C638439944279978146%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=jw1s4PDC%2BlUHLwZIdDyWX6u3EtG862aYoBUQX9XiGzY%3D&reserved=0>
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
> <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgeoserver.org%2Fcomm%2Fuserlist-guidelines.html&data=05%7C02%7Cchristophe.garault.ext%40orange.com%7Cc18668014b3a4f019d9d08dc31bf27d2%7C90c7a20af34b40bfbc48b9253b6f5d20%7C0%7C0%7C638439944279986042%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=ip6N%2B9%2BIqpmY%2Fx3KHV5o2Pn%2BaQt5rGU%2BFC3mhVkiquo%3D&reserved=0>
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgeoserver%2Fgeoserver%2Fwiki%2FSuccessfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer&data=05%7C02%7Cchristophe.garault.ext%40orange.com%7Cc18668014b3a4f019d9d08dc31bf27d2%7C90c7a20af34b40bfbc48b9253b6f5d20%7C0%7C0%7C638439944279992741%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=6mWy%2FvYW48n%2BkMjc8VGROi4sIIfa%2BgVjLNBkFygbFas%3D&reserved=0>
>
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fgeoserver-users&data=05%7C02%7Cchristophe.garault.ext%40orange.com%7Cc18668014b3a4f019d9d08dc31bf27d2%7C90c7a20af34b40bfbc48b9253b6f5d20%7C0%7C0%7C638439944279999427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=fsDCXBn2Zs8wqkmXZdszfpBcPvbmKJHTPGrPeRtJGdk%3D&reserved=0>
>
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to