-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Decouple from complex entrypoint script
- Loading branch information
Showing
3 changed files
with
28 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,9 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
# Initialize flags for config.json and private key | ||
CONFIG_EXISTS=false | ||
PK_EXISTS=false | ||
|
||
# Check if config.json exists | ||
if [ -f /app/config.json ]; then | ||
echo "config.json detected" | ||
CONFIG_EXISTS=true | ||
if [ -f "/app/config.json" ] && [ -f "/app/data-proxy-private-key.json" ]; then | ||
echo "Config and private key files found. Running with specific configuration." | ||
exec ./dataproxy run --config /app/config.json --private-key-file /app/data-proxy-private-key.json "$@" | ||
else | ||
echo "config.json not found" | ||
echo "Config or private key file not found. Running with default configuration." | ||
exec ./dataproxy run "$@" | ||
fi | ||
|
||
# Check if data-proxy-private-key.json exists | ||
if [ -f /app/data-proxy-private-key.json ]; then | ||
echo "data-proxy-private-key.json detected" | ||
PK_EXISTS=true | ||
elif [ -n "$SEDA_DATA_PROXY_PRIVATE_KEY" ]; then | ||
# If private key file does not exist, check if the private key is provided via environment variable | ||
echo "Private key provided via environment variable" | ||
echo "$SEDA_DATA_PROXY_PRIVATE_KEY" >/app/data-proxy-private-key.json | ||
PK_EXISTS=true | ||
else | ||
echo "No private key provided" | ||
fi | ||
|
||
run_bun_command() { | ||
if ! bun "$@"; then | ||
echo "Failed to run: bun $*" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Determine the command to run based on the presence of config.json and private key | ||
if [ "$CONFIG_EXISTS" = true ] && [ "$PK_EXISTS" = true ]; then | ||
# Both config.json and private key are provided | ||
echo "Running with config and private key" | ||
RUN_CMD="start run --config /app/config.json --private-key-file /app/data-proxy-private-key.json" | ||
elif [ "$CONFIG_EXISTS" = true ] && [ "$PK_EXISTS" = false ]; then | ||
# Only config.json is provided | ||
echo "Running with config only" | ||
run_bun_command start init | ||
RUN_CMD="start run --config /app/config.json" | ||
else | ||
# Neither config.json nor private key is provided | ||
echo "Running with --disable-proof" | ||
run_bun_command start init | ||
RUN_CMD="start run --disable-proof" | ||
fi | ||
|
||
# Execute the final command | ||
run_bun_command $RUN_CMD |