diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/ente_setup.iml b/.idea/ente_setup.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/ente_setup.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4951654 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/setup_postgres.sh b/setup_postgres.sh old mode 100644 new mode 100755 index 74aeddd..dc119d9 --- a/setup_postgres.sh +++ b/setup_postgres.sh @@ -3,6 +3,12 @@ # Exit immediately if a command exits with a non-zero status. set -e +# Check if the DB_PASSWORD environment variable is set +if [ -z "$DB_PASSWORD" ]; then + echo "The environment variable DB_PASSWORD is not set. Please set it and rerun the script." + exit 1 +fi + # Update package lists sudo apt-get update @@ -16,8 +22,8 @@ sudo systemctl enable postgresql # Switch to the postgres user sudo -i -u postgres bash << EOF -# Create user 'ente' with password 'ente_password' -psql -c "CREATE USER ente WITH PASSWORD 'ente_password';" +# Create user 'ente' with the password from the environment variable +psql -c "CREATE USER ente WITH PASSWORD '$DB_PASSWORD';" # Create a new database owned by 'ente' psql -c "CREATE DATABASE ente_db OWNER ente;" @@ -55,6 +61,6 @@ sudo systemctl restart postgresql # Confirm PostgreSQL is running and listening on the correct port sudo systemctl status postgresql -# netstat -plnt | grep postgres +netstat -plnt | grep postgres echo "PostgreSQL has been set up successfully with SSL. User 'ente' has been created with access via TCP/IP and SSL."