From 8af4990c1b44658cad90bfd16219a753cfadab86 Mon Sep 17 00:00:00 2001 From: liberhe <411497616@qq.com> Date: Wed, 13 Dec 2023 17:12:50 +0800 Subject: [PATCH 1/2] fix the start script --- .../dl/officialsite/file/cos/FileService.java | 1 - src/main/resources/application-template.yml | 10 ++++---- start.sh | 25 +++++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/dl/officialsite/file/cos/FileService.java b/src/main/java/com/dl/officialsite/file/cos/FileService.java index ff7ca522..211ff7ae 100644 --- a/src/main/java/com/dl/officialsite/file/cos/FileService.java +++ b/src/main/java/com/dl/officialsite/file/cos/FileService.java @@ -51,7 +51,6 @@ public String upload(MultipartFile file) { } catch (IOException e) { } //拼接返回路径 - cosClient.shutdown(); // String imagePath = "https://" + cosProperties.getBucketName() + ".cos." + cosProperties.getRegionName() + ".myqcloud.com/" + key; return key; } diff --git a/src/main/resources/application-template.yml b/src/main/resources/application-template.yml index cf0170a1..b5163744 100644 --- a/src/main/resources/application-template.yml +++ b/src/main/resources/application-template.yml @@ -44,7 +44,7 @@ logging: org.springframework.security: debug ipfs: - url: /ip4/127.0.0.1/tcp/5001 + url: "" web3j: client-address: "https://polygon-rpc.com" @@ -59,10 +59,10 @@ oauth: userInfoUri: https://api.github.com/user qcloud: - secretId: "" - secretKey: "" - bucketName: "" - regionName: "" + secretId: {{SECRET_ID}} + secretKey: {{SECRET_KEY}} + bucketName: {{BUCKET_NAME}} + regionName: {{REGION_NAME}} login: filter: true \ No newline at end of file diff --git a/start.sh b/start.sh index 68af1832..5f02b777 100644 --- a/start.sh +++ b/start.sh @@ -5,12 +5,37 @@ CLASSPATH='conf/:apps/*:lib/*' CURRENT_DIR=$(pwd)/ LOG_DIR=${CURRENT_DIR}log CONF_DIR=${CURRENT_DIR}conf + if [[ -n "$DBPWD" ]];then sed "s/{{SPRING_DATASOURCE_PASSWORD}}/$DBPWD/g" conf/application-template.yml > conf/application.yml else echo "by hand" fi +if [[ -n "$SECRET_ID" ]];then + sed "s/{{SECRET_ID}}/$SECRET_ID/g" conf/application-template.yml > conf/application.yml +else + echo "by hand" +fi + +if [[ -n "$SECRET_KEY" ]];then + sed "s/{{SECRET_KEY}}/$SECRET_KEY/g" conf/application-template.yml > conf/application.yml +else + echo "by hand" +fi + +if [[ -n "$BUCKET_NAME" ]];then + sed "s/{{BUCKET_NAME}}/$BUCKET_NAME/g" conf/application-template.yml > conf/application.yml +else + echo "by hand" +fi + +if [[ -n "$REGION_NAME" ]];then + sed "s/{{REGION_NAME}}/$REGION_NAME/g" conf/application-template.yml > conf/application.yml +else + echo "by hand" +fi + SERVER_PORT=$(cat $CONF_DIR/application.yml | grep "server:" -A 3 | grep "port" | awk '{print $2}'| sed 's/\r//') if [ ${SERVER_PORT}"" = "" ];then echo "$CONF_DIR/application.yml server port has not been configured" From 1d9c8d9581e87a4671251651bac7abab33011908 Mon Sep 17 00:00:00 2001 From: liberhe <411497616@qq.com> Date: Wed, 13 Dec 2023 17:17:58 +0800 Subject: [PATCH 2/2] fix the start script --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eae76131..c409febf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,6 +30,10 @@ jobs: bash ./gradlew build -x test cd dist export DBPWD=${{secrets.SPRING_DATASOURCE_PASSWORD}} + export SECRET_ID=${{secrets.SECRETID}} + export SECRET_KEY=${{secrets.SECRETKEY}} + export BUCKET_NAME=${{secrets.BUCKETNAME}} + export REGION_NAME=${{secrets.REGIONNAME}} bash stop.sh bash start.sh