-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·26 lines (19 loc) · 932 Bytes
/
setup.sh
File metadata and controls
executable file
·26 lines (19 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
set -e
DB_CONTAINER_NAME=postgresql
echo "Setting up environment configuration..."
echo
read -p "Database username: " DB_USER
read -s -p "Database password: " DB_PASSWORD
echo
read -p "Database name: " DB_NAME
read -s -p "PostgreSQL admin password: " DB_POSTGRES_PASSWORD
echo
JWT_SECRET=$(openssl rand -hex 32)
sed -i "s/POSTGRESQL_USERNAME=.*/POSTGRESQL_USERNAME=$DB_USER/" postgresql/postgresql.env
sed -i "s/POSTGRESQL_PASSWORD=.*/POSTGRESQL_PASSWORD=$DB_PASSWORD/" postgresql/postgresql.env
sed -i "s/POSTGRESQL_DATABASE=.*/POSTGRESQL_DATABASE=$DB_NAME/" postgresql/postgresql.env
sed -i "s/POSTGRESQL_POSTGRES_PASSWORD=.*/POSTGRESQL_POSTGRES_PASSWORD=$DB_POSTGRES_PASSWORD/" postgresql/postgresql.env
sed -i "s|DATABASE_URL=.*|DATABASE_URL=postgres://$DB_USER:$DB_PASSWORD@$DB_CONTAINER_NAME/$DB_NAME|" ejd/ejd.env
sed -i "s/JWT_SECRET=.*/JWT_SECRET=$JWT_SECRET/" ejd/ejd.env
echo "Configuration complete!"