shiwan7788 commited on
Commit
42ab2e1
·
1 Parent(s): 0cc5a68

Create entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +31 -0
entrypoint.sh ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # entrypoint.sh,记得删除本行
2
+ #!/bin/sh
3
+ set -e
4
+ CONFIG_FILE_PATH="/home/api.yaml" # 注意这里改成/home/api.yaml
5
+
6
+ echo "DEBUG: Entrypoint script started."
7
+
8
+ # 检查Secret是否存在
9
+ if [ -z "$API_YAML_CONTENT" ]; then
10
+ echo "ERROR: Secret 'API_YAML_CONTENT' is不存在或为空。退出。"
11
+ exit 1
12
+ else
13
+ echo "DEBUG: API_YAML_CONTENT secret found. Preparing to write..."
14
+ printf '%s\n' "$API_YAML_CONTENT" > "$CONFIG_FILE_PATH"
15
+ echo "DEBUG: Attempted to write to $CONFIG_FILE_PATH."
16
+
17
+ if [ -f "$CONFIG_FILE_PATH" ]; then
18
+ echo "DEBUG: File $CONFIG_FILE_PATH created successfully. Size: $(wc -c < "$CONFIG_FILE_PATH") bytes."
19
+ # 显示文件的前几行进行调试(注意不要显示敏感信息)
20
+ echo "DEBUG: First few lines (without sensitive info):"
21
+ head -n 3 "$CONFIG_FILE_PATH" | grep -v "api:" | grep -v "password"
22
+ else
23
+ echo "ERROR: File $CONFIG_FILE_PATH was NOT created."
24
+ exit 1
25
+ fi
26
+ fi
27
+
28
+ echo "DEBUG: About to execute python main.py..."
29
+ # 不需要使用--config参数,因为程序有默认路径
30
+ cd /home
31
+ exec python main.py "$@"