Merge pull request #111 from caminsha/postgresconfig

Add POSTGRESQL_SECRET as environement variable
This commit is contained in:
chandi 2021-06-21 16:19:26 +02:00 committed by GitHub
commit 1af4e3af73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -330,7 +330,7 @@ services:
DB_HOST: postgres
DB_NAME: greenlight
DB_USERNAME: postgres
DB_PASSWORD: password
DB_PASSWORD: ${POSTGRESQL_SECRET:-password}
{{ if isTrue .Env.DEV_MODE }}
BIGBLUEBUTTON_ENDPOINT: http://10.7.7.1:8080/bigbluebutton/api/
{{else}}
@ -346,7 +346,7 @@ services:
environment:
POSTGRES_DB: greenlight
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_PASSWORD: ${POSTGRESQL_SECRET:-password}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s

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