Closed whitingjr closed 11 months ago
the prompt
under sh
and the add-prompt
do not support regex pattern matching at this time although that is worth exploring.
In the meantime they do support qDup pattern substitution with ${{..}}
. If you know the user that is used for the psql command you could store that in a qDup state variable (a script level variable would work, no need to add it to states
in yaml) and use that as part of the prompt:
Password for user ${{userName}}:
good to know thanks. Sadly the environments have a variety of PG versions. Some will match but others not. The ability to use a regex will be very useful.
an alternative to entering the pword at prompt is to set the PGPASSWORD
env variable using a secret and that should be portable across all PG versions
for the psql
command there is no env variable support for PGPASSWORD
.
using PGPASSWORD did work. ty
PGPASSWORD=${{DB_PWD}} psql -h ${{DB_HOST}} -U ${{DB_USER}} ${{DB_SCHEMA}}
The documentation indicates using prompt command when expecting interactive input from the user. This works fine except when the interactive tool changes the prompt text. eg psql command has changed over versions:
Password:
Password for user ****:
The prompt needs to be adaptable to either of these strings. Trying to use a regex"Password.*: "
does not seem to work.