diff --git a/.drone.yml b/.drone.yml index e218d98..7182897 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,7 +18,6 @@ steps: trigger: branch: - main - - drone-deploy event: - push - tag \ No newline at end of file diff --git a/README.md b/README.md index a48ada2..6573adc 100644 --- a/README.md +++ b/README.md @@ -208,4 +208,22 @@ you can see the container is runninng like as follow. ![image](https://user-images.githubusercontent.com/51738970/178057363-1351be0d-16a9-460a-a8dd-57ab86c0653b.png) ## 4. API test -you can reference [Test the API can parse data](https://github.com/a631953720/thingsboard-sendbox/blob/main/README.md#4-test-the-api-can-parse-data) +you can reference [Test the API can parse data](#4-test-the-api-can-parse-data) + +# Customzied the docker +## `release/.env` can control all the docker image config +```env +# project build +OUTPUT_FOLDER=output # create folder in root path +OUTPUT_IMAGE_FILE_NAME=thingsboard-sendbox + +# deploy +DEPLOY_VERSION=v0.2.0-beta +DEPLOY_PORT=8000 +SERVER_LISTEN=8000 # must equal to the "config.json" at root folder + +# docker +IMAGE_NAME=thingsboard-sendbox +CONTAINER_NAME=thingsboard-sendbox + +``` diff --git a/release/rewrite_config.sh b/release/rewrite_config.sh index 17eb6bd..a4123f7 100644 --- a/release/rewrite_config.sh +++ b/release/rewrite_config.sh @@ -7,6 +7,8 @@ copy_config="../config.origin.json" yellow_printf "rename origin config.json" mv ${config} ${copy_config} +# make sure that the production flag is 'true' +# it can don't need to modify the config file every drone deploy yellow_printf "rewrite the config file to production" rewrite_config_file ${copy_config} ${config} green_printf "convert the 'production' flag to 'true'" diff --git a/release/utils.sh b/release/utils.sh index 0cb308f..10bd102 100644 --- a/release/utils.sh +++ b/release/utils.sh @@ -33,8 +33,9 @@ function load_dot_env() { yellow_printf "------ read env end ------" } -# 會逐行讀取取得屬性值,只能取得單純的字串、數字或布林 -# 如果重複,只會回傳第一個找到的值 +# will read the file line by line +# only can get string, number, and boolean +# only return the first result function find_json_value() { while read -r LINE; do # can ignore @@ -48,6 +49,7 @@ function find_json_value() { echo $REAULT } +# this function case only for this project situation function rewrite_config_file() { target_file=$1 new_file=$2