Add POSTGRESQL_SECRET as environement variable

The way like this it is possible to have the password for PostgreSQL as an environment variable
This commit is contained in:
caminsha 2021-05-14 03:05:07 +02:00
parent 0c37742980
commit 63a72de927
3 changed files with 10 additions and 1 deletions

View File

@ -330,7 +330,7 @@ services:
DB_HOST: postgres
DB_NAME: greenlight
DB_USERNAME: postgres
DB_PASSWORD: password
DB_PASSWORD: ${POSTGRESQL_SECRET}
{{ if isTrue .Env.DEV_MODE }}
BIGBLUEBUTTON_ENDPOINT: http://10.7.7.1:8080/bigbluebutton/api/
{{else}}

View File

@ -35,6 +35,7 @@ ENABLE_GREENLIGHT=true
SHARED_SECRET=w6y7nycPafjPhVz3gZdBpQhR4H4MvEQzcZzia5LT
ETHERPAD_API_KEY=NEQKi2eFXSBce4kyGjwAzMn2jeF66peNYQmyFVRr
RAILS_SECRET=cdfbae48b197805a435ab7881da31c642ac1a7d4d5c006441efa8125ae63865ce7c915c651117e0f14358cd98f5287c431929e0f796f4100b2b1c3eb5baad1b0
POSTGRESQL_SECRET=4xksXUDsaqAkZFSu8HF7pFppN34yy0a9g2iSqD14

View File

@ -115,9 +115,17 @@ fi
RANDOM_1=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
RANDOM_2=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
RANDOM_3=$(head /dev/urandom | tr -dc a-f0-9 | head -c 128)
if [ ! "$greenlight" == "y" ]
then
RANDOM_4=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
fi
sed -i "s/SHARED_SECRET=.*/SHARED_SECRET=$RANDOM_1/" .env
sed -i "s/ETHERPAD_API_KEY=.*/ETHERPAD_API_KEY=$RANDOM_2/" .env
sed -i "s/RAILS_SECRET=.*/RAILS_SECRET=$RANDOM_3/" .env
if [ ! "$greenlight" == "y" ]
then
sed -i "s/POSTGRESQL_SECRET=.*/POSTGRESQL_SECRET=$RANDOM_4/" .env
fi
./scripts/generate-compose