Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

[+] allow .pgpass lookup for web UI #646

Merged
merged 3 commits into from
Jun 12, 2023

Conversation

krisavi
Copy link
Contributor

@krisavi krisavi commented May 30, 2023

Currently it does not support pgpass for web config db. This will fix it. If password is provided, then it will be used instead.

@pashagolub pashagolub self-assigned this May 31, 2023
@pashagolub pashagolub changed the title Allow pgpass lookup for web [+] allow .pgpass lookup for web UI May 31, 2023
@pashagolub
Copy link
Collaborator

pashagolub commented May 31, 2023

Seems to be a breaking change. @kmoppel any ideas on this? /cc @kmoppel-cognite

@krisavi
Copy link
Contributor Author

krisavi commented May 31, 2023

The issue is that when you do not provide password, then currently it will set the default value which is not empty and when you provide some password, then it will not do any .pgpass lookup. Lookup works fine for metric DB, but not for config DB.

This could break docker container if it assumes this value is coming from default value set here:

pgwatch2/webpy/web.py

Lines 367 to 368 in 26cb0be

parser.add_argument('--password', help='Pgwatch2 Config DB password',
default=(os.getenv('PW2_PGPASSWORD') or 'pgwatch2admin'))

In that case maybe it would be good to set it for docker container with environment variables. Generally default value for passwords is assumed to be empty string.

@kmoppel-cognite
Copy link
Collaborator

I think its OK to have it as is, it won't break the default Docker containers because there's trust auth for 127.0.0.1 - but please also change ENV_VARIABLES.md to reflect new default @krisavi Otherwise a nice thing to have!

@krisavi
Copy link
Contributor Author

krisavi commented Jun 12, 2023

OK, I will add commit updating ENV_VARIABLES.md

@krisavi
Copy link
Contributor Author

krisavi commented Jun 12, 2023

Prettier VSCode extension removed duplicate empty rows in ENV_VARIABLES.md as well.

@pashagolub
Copy link
Collaborator

Thanks for your help!

@pashagolub pashagolub merged commit 9f75d25 into cybertec-postgresql:master Jun 12, 2023
@krisavi krisavi deleted the web_pgpass_fix branch June 13, 2023 11:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants