update @native
Some checks failed
Setup Docker Action / setup_docker (3.12.7) (push) Has been skipped
Setup Native Action / setup_native (3.12.7) (push) Failing after 1m50s

This commit is contained in:
hoangvv 2025-01-15 11:21:48 +07:00
parent 7c22bc7c84
commit ba5c38f465

View File

@ -199,9 +199,9 @@ Generate_Config_Native(){
USER="${REPO_NAME:-"default_repo"}"
PASSWORD="$(openssl rand -hex 24)"
# Check if the user already exists
USER_EXISTS=$(psql "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_SERVER}:${DB_PORT}/postgres" -c "SELECT 1 FROM pg_roles WHERE rolname='$USER';")
USER_EXISTS=$(psql "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_SERVER}:${DB_PORT}/postgres" -t -A -c "SELECT COUNT(*) FROM pg_roles WHERE rolname='$USER';")
if [ -z "$USER_EXISTS" ]; then
if [ "$USER_EXISTS" -eq 0 ]; then
# User does not exist, create the user
Show 2 "Create the new PostgreSQL username: $USER with password: $PASSWORD"
psql "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_SERVER}:${DB_PORT}/postgres" -c "CREATE USER $USER WITH PASSWORD '$PASSWORD';"