Repository navigation
Support PGAPPNAME - #1444
Support PGAPPNAME#1444
Conversation
|
Set as draft because I want to get some unittests in |
|
Added one unit test setting PGAPPNAME in the environment variables. Did not add one using the command line argument since click will treat them both the same (in theory). Let me know if there is any corrections I need to make, thanks. |
|
Very nice @crazybolillo , thank you for the PR! |
|
I see one of the integration tests failed: pgcli/tests/features/steps/basic_commands.py Line 177 in f2156b3 |
Yes, it seems like the default None value from click was overriding the default value for application_name on the PGCli constructor. There are other ways but I have fixed it by setting the default as 'pgcli' directly from click. Is that ok? |
The application_name to be used when connecting to a database can now be specified as a command line argument (--application-name) or be taken directly from environment variables (PGAPPNAME). It still defaults to 'pgcli' when not specified. Closes #1421.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1444 +/- ##
==========================================
+ Coverage 79.67% 79.88% +0.21%
==========================================
Files 25 25
Lines 3041 3043 +2
==========================================
+ Hits 2423 2431 +8
+ Misses 618 612 -6 ☔ View full report in Codecov by Sentry. |
|
Looks good now! Merging. 🍒 |
|
Amazing! Thanks @crazybolillo and @j-bennet!! 🚀 |
The application_name to be used when connecting to a database can now be specified as a command line argument (--application-name) or be taken directly from environment variables (PGAPPNAME). It still defaults to 'pgcli' when not specified.
Closes #1421.
Description
I added a new click option to support
PGAPPNAMEand created a new class member forPGCliwhich stores the set value. This value is then used during theconnectmethod unless a different value was stated in**kwargs.Checklist
changelog.rst.AUTHORSfile (or it's already there).pip install pre-commit && pre-commit install), and ranblackon my code.