Pass environment variables in compose file

This commit is contained in:
Adw8 2024-07-16 18:54:23 +05:30
parent af525ab404
commit b00dcb66c8
2 changed files with 12 additions and 12 deletions

View File

@ -3,11 +3,11 @@ services:
restart: unless-stopped
image: cerc/laconic-faucet:local
environment:
${CERC_SCRIPT_DEBUG}
${CERC_FAUCET_KEY}
volumes:
- ../config/laconic-faucet/start-server.sh:/start-server.sh
ports:
- "3000"
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_FAUCET_KEY: ${CERC_FAUCET_KEY}
entrypoint: "bash"
command: "/start-server.sh"
command: "./start-faucet.sh"
volumes:
- ../config/laconic-faucet/start-faucet.sh:/app/start-faucet.sh
ports:
- "3000:3000"

View File

@ -1,17 +1,16 @@
#!/bin/bash
set -e
set -u
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
set -u
yarn install
toml_file = "/app/environments/local.toml"
toml_file="./environments/local.toml"
# Set faucet key from env
faucet_key = ${CERC_FAUCET_KEY}
faucet_key=${CERC_FAUCET_KEY}
echo "The faucet key is $faucet_key"
# Update the faucetKey in local.toml
sed -i "s/faucetKey = \"\"/faucetKey = \"$faucet_key\"/" "$toml_file"
@ -19,3 +18,4 @@ echo "Updated faucetKey in local.toml"
# Start node-js server
yarn start-faucet
echo "Started faucet"