Skip to content

Commit

Permalink
Merge pull request #34 from geniusyield/24-dockerize-5
Browse files Browse the repository at this point in the history
24 dockerize 5
  • Loading branch information
4TT1L4 authored Apr 2, 2024
2 parents af7c356 + eb2fc48 commit fea9767
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
11 changes: 4 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
server:
image: ghcr.io/geniusyield/dex-contracts-api:latest
container_name: server
restart: always
ports:
- "8082:8082"
environment:
Expand All @@ -14,16 +15,12 @@ services:
coreProvider:
maestroToken: <<CORE_MAESTRO_API_KEY>>
turboSubmit: false
networkId: "mainnet" # supported: mainnet ot preprod
logging:
- type: {tag: stderr}
severity: "Debug" # Options: Debug, Info, Warning or Error
verbosity: V2 # Options: `V0`, `V1`, `V2`, `V3` and `V4` (See katip docs for details)
port: 8082
networkId: mainnet
logging: [{type: {tag: stderr}, severity: "Debug", verbosity: "V2"}]
maestroToken: <<MAESTRO_API_KEY>>
serverApiKey: <<SERVER_API_KEY>>
wallet:
tag: mnemonicWallet
contents:
mnemonic: <<SEED_PHRASE>>
restart: always
port: 8082
15 changes: 10 additions & 5 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [ -z "$SERVER_CONFIG" ]; then
echo "Error: SERVER_CONFIG environment variable is not set." >&2
exit 1 # Exit code 1 for unset variable
fi


if [ -z "$CORE_MAESTRO_API_KEY" ]; then
echo "Error: CORE_MAESTRO_API_KEY environment variable is not set." >&2
exit 1 # Exit code 1 for unset variable
Expand Down Expand Up @@ -40,12 +42,15 @@ fi
echo "SERVER_CONFIG is set and contains a valid YAML document."
echo "===================================="
echo "Replace placeholders...."
export SERVER_CONFIG=$(echo "$SERVER_CONFIG" | sed "s%<<CORE_MAESTRO_API_KEY>>%$CORE_MAESTRO_API_KEY%g")
export SERVER_CONFIG=$(echo "$SERVER_CONFIG" | sed "s%<<MAESTRO_API_KEY>>%$MAESTRO_API_KEY%g")
export SERVER_CONFIG=$(echo "$SERVER_CONFIG" | sed "s%<<SERVER_API_KEY>>%$SERVER_API_KEY%g")
export SERVER_CONFIG=$(echo "$SEED_PHRASE" | sed "s%<<SEED_PHRASE>>%$SEED_PHRASE%g")
echo "$SERVER_CONFIG" > ./server_config.yaml
sed -i "s|<<CORE_MAESTRO_API_KEY>>|${CORE_MAESTRO_API_KEY}|" server_config.yaml
sed -i "s|<<MAESTRO_API_KEY>>|${MAESTRO_API_KEY}|" server_config.yaml
sed -i "s|<<SERVER_API_KEY>>|${SERVER_API_KEY}|" server_config.yaml
sed -i "s|<<SEED_PHRASE>>|${SEED_PHRASE}|" server_config.yaml
export SERVER_CONFIG=$(cat server_config.yaml)
echo "[OK] Done. Replaced placeholders."
# Attempt to parse SERVER_CONFIG as YAML after replacing the placholders

# Attempt to parse SERVER_CONFIG as YAML after replacing the placholde
echo "$SERVER_CONFIG" | yq eval . - > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Error: SERVER_CONFIG does not contain a valid YAML document after replacing the placeholders ." >&2
Expand Down

0 comments on commit fea9767

Please sign in to comment.