update @native
This commit is contained in:
parent
7c22bc7c84
commit
ba5c38f465
@ -199,9 +199,9 @@ Generate_Config_Native(){
|
|||||||
USER="${REPO_NAME:-"default_repo"}"
|
USER="${REPO_NAME:-"default_repo"}"
|
||||||
PASSWORD="$(openssl rand -hex 24)"
|
PASSWORD="$(openssl rand -hex 24)"
|
||||||
# Check if the user already exists
|
# 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
|
# User does not exist, create the user
|
||||||
Show 2 "Create the new PostgreSQL username: $USER with password: $PASSWORD"
|
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';"
|
psql "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_SERVER}:${DB_PORT}/postgres" -c "CREATE USER $USER WITH PASSWORD '$PASSWORD';"
|
||||||
|
Loading…
Reference in New Issue
Block a user