That’s a clever trick Peter, thanks a lot. 

As I don’t need the old datastore anymore I’ll just replace the Id of the newly 
created one with the old one after moving all the published layers to the right 
place. 

 

 

Regards,

—
Christophe GARAULT 

 

De : Peter Smythe <g...@smythe.co.za> 
Envoyé : mardi 20 février 2024 17:33
À : GARAULT Christophe Ext DTSI/DTR <christophe.garault....@orange.com>
Cc : Jody Garnett <jody.garn...@gmail.com>; 
geoserver-users@lists.sourceforge.net
Objet : Re: [Geoserver-users] How to parameterize password of a datastore ?

 



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, < <mailto:christophe.garault....@orange.com> 
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 < <mailto:jody.garn...@gmail.com> jody.garn...@gmail.com> 
Envoyé : mardi 20 février 2024 03:53
À : GARAULT Christophe Ext DTSI/DTR < 
<mailto:christophe.garault....@orange.com> christophe.garault....@orange.com>
Cc :  <mailto:geoserver-users@lists.sourceforge.net> 
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 < <mailto:christophe.garault....@orange.com> 
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)

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#/
- 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


 <mailto:Geoserver-users@lists.sourceforge.net> 
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


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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
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