add env var for password and set up .idea editor

This commit is contained in:
2024-11-02 21:30:59 -06:00
parent 48d5c01e0a
commit 209b65d933
5 changed files with 40 additions and 3 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@ -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

9
.idea/ente_setup.iml generated Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ente_setup.iml" filepath="$PROJECT_DIR$/.idea/ente_setup.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

12
setup_postgres.sh Normal file → Executable file
View File

@ -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."