刘洪青 | 4720585 | 2020-08-14 13:39:30 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | replace_file() { |
| 4 | local file="$1" |
| 5 | local key="$2" |
| 6 | local value="$3" |
| 7 | sed -i "s;\${$key};$value;" $file |
| 8 | } |
| 9 | |
| 10 | # 如果第一个参数是app,那么就启动执行nginx |
| 11 | if [ "$1" = 'app' ]; then |
| 12 | |
| 13 | if [ -n "$POA_SERVER_URL" ]; then |
| 14 | replace_file "/root/poa-api-docs/user-data-service-poa.v1.yaml" "POA_SERVER_URL" "$POA_SERVER_URL" |
| 15 | replace_file "/root/poa-api-docs/user-authorization-service-poa.v1.yaml" "POA_SERVER_URL" "$POA_SERVER_URL" |
刘洪青 | 4720585 | 2020-08-14 13:39:30 +0800 | [diff] [blame] | 16 | replace_file "/root/poa-api-docs/communicate-center-poa.v1.yaml" "POA_SERVER_URL" "$POA_SERVER_URL" |
| 17 | fi |
| 18 | |
刘洪青 | b42034e | 2020-10-13 00:25:42 +0800 | [diff] [blame] | 19 | # if [ -n "$POA_SA_SERVER_URL" ]; then |
| 20 | # replace_file "/root/poa-api-docs/exec.sh" "POA_SA_SERVER_URL" "$POA_SA_SERVER_URL" |
| 21 | # fi |
| 22 | |
刘洪青 | 4720585 | 2020-08-14 13:39:30 +0800 | [diff] [blame] | 23 | set -ex; |
| 24 | exec /root/poa-api-docs/exec.sh |
| 25 | else |
| 26 | set -ex; |
| 27 | exec "$@" |
| 28 | fi |