sunwangwang commited on
Commit
1c6b7dc
·
verified ·
1 Parent(s): 4708824

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +27 -0
entrypoint.sh CHANGED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -e
3
+ CONFIG_FILE_PATH="/home/api.yaml" # Note this is changed to /home/api.yaml
4
+ echo "DEBUG: Entrypoint script started."
5
+ # Check if Secret exists
6
+ if [ -z "$API_YAML_CONTENT" ]; then
7
+ echo "ERROR: Secret 'API_YAML_CONTENT' does not exist or is empty. Exiting."
8
+ exit 1
9
+ else
10
+ echo "DEBUG: API_YAML_CONTENT secret found. Preparing to write..."
11
+ printf '%s\n' "$API_YAML_CONTENT" > "$CONFIG_FILE_PATH"
12
+ echo "DEBUG: Attempted to write to $CONFIG_FILE_PATH."
13
+
14
+ if [ -f "$CONFIG_FILE_PATH" ]; then
15
+ echo "DEBUG: File $CONFIG_FILE_PATH created successfully. Size: $(wc -c < "$CONFIG_FILE_PATH") bytes."
16
+ # Display the first few lines for debugging (be careful not to display sensitive information)
17
+ echo "DEBUG: First few lines (without sensitive info):"
18
+ head -n 3 "$CONFIG_FILE_PATH" | grep -v "api:" | grep -v "password"
19
+ else
20
+ echo "ERROR: File $CONFIG_FILE_PATH was NOT created."
21
+ exit 1
22
+ fi
23
+ fi
24
+ echo "DEBUG: About to execute python main.py..."
25
+ # No need to use the --config parameter as the program has a default path
26
+ cd /home
27
+ exec python main.py "$@"