[issue2551299] Connecting to PostgreSQL database using pg_service.conf
John Rouillard <[email protected]> Tue, 07 Nov 2023 01:36:17 +0000
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
New submission from John Rouillard: In the email chain starting with: https://sourceforge.net/p/roundup/mailman/message/51780738/ ---- From: ivanov On 2023-11-06 23:13, John P. Rouillard wrote: > Try this. Set the environment variable: > > PGSERVICE=your_service_name > > Then remove any values for the settings: > > host, port, user, password, and name > > in the rdbms section of the tracker's config.ini. (If you are not > setting some of those values in your pg_service.conf, set them in > config.ini.) Make sure the rdbms backend setting is set to postgresql. > > If your pg_service.conf file looks like: > > [roundup_roundup] > host=127.0.0.1 > port=5432 > user=rounduptest > password=rounduptest > dbname=rounduptest > > (the defaults for demo mode), run: > > roundup-admin -i tracker_home list status > > and see if you get a connection error. Excellent! Thank you very much. I will try it. > psycopg2 looks like it can use a "service=service_name" in its connect > method. (Working from https://github.com/psycopg/psycopg2/issues/926.) Django can use psycopg2/psycopg3 in a similar way. [...] details can be found here: https://code.djangoproject.com/ticket/32292 > It might be a useful enhancement to support 'service' directly in > config.ini. It would be useful when running one roundup server serving > multiple trackers. > > If you want to move forward with Roundup and run multiple trackers > with one Roundup server instance, we can work on getting support for > specifying the 'service' in config.ini. You would need to test using > the current development code. Thank you. At the moment I plan to install only one tracker, but I think it would be nice to have such an option. When you implement this, I will be happy to test it. ----- Implementation thoughts. Add [rdbms] service configuration setting to configuration.py. String value. Default None/empty. Modify rdbms_common.py:connection_dict() to add 'service' to name tuple. Because default service is None, no need to filter the setting out in the connection_dict in back_mysql.py or back_postgresql.py. Add doc to upgrading.txt on how to configure it. Find out what happens if password is set in config.ini and in pg_service.conf. Doc same. I suspect that setting in config.ini will take priority. I think that's it but we shall find out 8-). ---------- messages: 7857 nosy: rouilj severity: normal status: new title: Connecting to PostgreSQL database using pg_service.conf _________________________________________________ Roundup tracker <[email protected]> <https://issues.roundup-tracker.org/issue2551299> _________________________________________________