Skip to content

Commit

Permalink
Merge pull request #68 from HorizenOfficial/development
Browse files Browse the repository at this point in the history
 Fixing entrypoint for 1.0.0 to main
  • Loading branch information
paolocappelletti authored Oct 2, 2023
2 parents 5bb3f63 + c15e2a4 commit a8211ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
24 changes: 21 additions & 3 deletions dockerfiles/evmapp/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ SCNODE_REST_APIKEYHASH=""
MAX_INCOMING_CONNECTIONS=""
MAX_OUTGOING_CONNECTIONS=""
WS_ADDRESS=""
ONLY_CONNECT_TO_KNOWN_PEERS=""
FORGER_MAXCONNECTIONS=""

SCNODE_REMOTE_KEY_MANAGER_ENABLED="${SCNODE_REMOTE_KEY_MANAGER_ENABLED:-false}"
export SCNODE_REMOTE_KEY_MANAGER_ENABLED
Expand Down Expand Up @@ -87,8 +89,6 @@ to_check=(
"SCNODE_WS_SERVER_PORT"
"SCNODE_WS_CLIENT_ENABLED"
"SCNODE_WS_SERVER_ENABLED"
"SCNODE_ONLY_CONNECT_TO_KNOWN_PEERS"
"SCNODE_FORGER_MAXCONNECTIONS"
)
for var in "${to_check[@]}"; do
if [ -z "${!var:-}" ]; then
Expand Down Expand Up @@ -175,6 +175,24 @@ if [ "${SCNODE_FORGER_ENABLED:-}" = "true" ] || [ "${SCNODE_CERT_SUBMITTER_ENABL
fi
fi

# Checking SCNODE_FORGER_MAXCONNECTIONS for Forger nodes
if [ "${SCNODE_FORGER_ENABLED:-}" = "true" ]; then
if [ -n "${SCNODE_FORGER_MAXCONNECTIONS:-}" ]; then
FORGER_MAXCONNECTIONS="$(echo -en "\n maxForgerConnections = ${SCNODE_FORGER_MAXCONNECTIONS}")"
else
echo "Error: Environment variable SCNODE_FORGER_MAXCONNECTIONS is required when SCNODE_FORGER_ENABLED=true !!!"
sleep 5
exit 1
fi
fi
export FORGER_MAXCONNECTIONS

# setting onlyConnectToKnownPeers if provided
if [ -n "${SCNODE_ONLY_CONNECT_TO_KNOWN_PEERS:-}" ]; then
ONLY_CONNECT_TO_KNOWN_PEERS="$(echo -en "\n onlyConnectToKnownPeers = ${SCNODE_ONLY_CONNECT_TO_KNOWN_PEERS}")"
fi
export ONLY_CONNECT_TO_KNOWN_PEERS

# Flexibility for log levels
if [ -z "${SCNODE_LOG_FILE_LEVEL:-}" ]; then
SCNODE_LOG_FILE_LEVEL='info'
Expand Down Expand Up @@ -296,7 +314,7 @@ SUBST='$SCNODE_CERT_MASTERS_PUBKEYS:$SCNODE_CERT_SIGNERS_MAXPKS:$SCNODE_CERT_SIG
'$SCNODE_NET_DECLAREDADDRESS:$SCNODE_NET_KNOWNPEERS:$SCNODE_NET_MAGICBYTES:$SCNODE_NET_NODENAME:$SCNODE_NET_P2P_PORT:$SCNODE_NET_API_LIMITER_ENABLED:$SCNODE_NET_SLOW_MODE:$SCNODE_NET_REBROADCAST_TXS:$SCNODE_NET_HANDLING_TXS:'\
'$SCNODE_WALLET_GENESIS_SECRETS:$SCNODE_WALLET_MAXTX_FEE:$SCNODE_WALLET_SEED:$WS_ADDRESS:$MAX_INCOMING_CONNECTIONS:$MAX_OUTGOING_CONNECTIONS:$SCNODE_WS_SERVER_PORT:'\
'$SCNODE_WS_CLIENT_ENABLED:$SCNODE_WS_SERVER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ADDRESS:$SCNODE_LOG_FILE_LEVEL:$SCNODE_LOG_CONSOLE_LEVEL:$REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:$REMOTE_KEY_MANAGER_PARALLEL_REQUESTS:'\
'$SCNODE_REST_APIKEYHASH:$SCNODE_REST_PORT:$SCNODE_ONLY_CONNECT_TO_KNOWN_PEERS:$SCNODE_FORGER_MAXCONNECTIONS'\
'$SCNODE_REST_APIKEYHASH:$SCNODE_REST_PORT:$ONLY_CONNECT_TO_KNOWN_PEERS:$FORGER_MAXCONNECTIONS'\

export SUBST
envsubst "${SUBST}" < /sidechain/config/sc_settings.conf.tmpl > /sidechain/config/sc_settings.conf
Expand Down
4 changes: 1 addition & 3 deletions dockerfiles/evmapp/sc_settings.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ sparkz {
rebroadcastQueueSize = 1024
rebroadcastBatchSize = 75
handlingTransactionsEnabled = $SCNODE_NET_HANDLING_TXS
onlyConnectToKnownPeers = $SCNODE_ONLY_CONNECT_TO_KNOWN_PEERS
maxForgerConnections = $SCNODE_FORGER_MAXCONNECTIONS
isForgerNode = $SCNODE_FORGER_ENABLED
isForgerNode = $SCNODE_FORGER_ENABLED$FORGER_MAXCONNECTIONS$ONLY_CONNECT_TO_KNOWN_PEERS
}

apiRateLimiter {
Expand Down

0 comments on commit a8211ff

Please sign in to comment.