From 10dcc514a42ef86467cc6ecf8a72774b99e3bbb1 Mon Sep 17 00:00:00 2001 From: Alessandro Domanico Date: Tue, 10 Sep 2024 15:24:01 +0200 Subject: [PATCH] Update script to use the new application.properties.dist file (#2049) --- oh.ps1 | 7 +++++-- oh.sh | 5 ++++- ohmac.sh | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/oh.ps1 b/oh.ps1 index 4051d3ecf1..ca4812a1a7 100644 --- a/oh.ps1 +++ b/oh.ps1 @@ -984,8 +984,11 @@ function write_api_config_file { # generate OH API token and save to settings file $JWT_TOKEN_SECRET=( -join ($(for($i=0; $i -lt 64; $i++) { ((65..90)+(97..122)+(".")+("!")+("?")+("&") | Get-Random | % {[char]$_}) })) ) Write-Host "Writing OH API configuration file -> $API_SETTINGS..." - (Get-Content "$OH_PATH/$OH_DIR/rsc/$API_SETTINGS.dist").replace("JWT_TOKEN_SECRET","$JWT_TOKEN_SECRET") | Set-Content "$OH_PATH/$OH_DIR/rsc/$API_SETTINGS" - (Get-Content "$OH_PATH/$OH_DIR/rsc/$API_SETTINGS").replace("OH_API_PID","$OH_API_PID") | Set-Content "$OH_PATH/$OH_DIR/rsc/$API_SETTINGS" + (Get-Content "$OH_PATH/$OH_DIR/rsc/$API_SETTINGS.dist") ` + -replace "JWT_TOKEN_SECRET", "$JWT_TOKEN_SECRET" ` + -replace "OH_API_PID", "$OH_API_PID" ` + -replace "API_HOST:API_PORT", "localhost:8080" ` + | Set-Content "$OH_PATH/$OH_DIR/rsc/$API_SETTINGS" } } diff --git a/oh.sh b/oh.sh index 000cf21fb2..16cceb9fa7 100644 --- a/oh.sh +++ b/oh.sh @@ -876,7 +876,10 @@ function write_api_config_file { # JWT_TOKEN_SECRET=`openssl rand -base64 64 | xargs` JWT_TOKEN_SECRET=`LC_ALL=C tr -dc A-Za-z0-9 $API_SETTINGS..." - sed -e "s/JWT_TOKEN_SECRET/"$JWT_TOKEN_SECRET"/g" -e "s&OH_API_PID&"$OH_API_PID"&g" ./$OH_DIR/rsc/$API_SETTINGS.dist > ./$OH_DIR/rsc/$API_SETTINGS + sed -e "s/JWT_TOKEN_SECRET/"$JWT_TOKEN_SECRET"/g" \ + -e "s&OH_API_PID&"$OH_API_PID"&g" \ + -e "s/API_HOST:API_PORT/localhost:8080/g" \ + ./$OH_DIR/rsc/$API_SETTINGS.dist > ./$OH_DIR/rsc/$API_SETTINGS fi } diff --git a/ohmac.sh b/ohmac.sh index 447e822c43..05e2cf529d 100755 --- a/ohmac.sh +++ b/ohmac.sh @@ -268,7 +268,11 @@ function write_api_config_file { JWT_TOKEN_SECRET=`LC_ALL=C tr -dc A-Za-z0-9 $API_SETTINGS..." - sed -i '' -e "s/JWT_TOKEN_SECRET/"$JWT_TOKEN_SECRET"/g" -e "s&OH_API_PID&"$OH_API_PID"&g" $SET_FILE.dist + sed -i '' \ + -e "s/JWT_TOKEN_SECRET/$JWT_TOKEN_SECRET/g" \ + -e "s/API_HOST:API_PORT/localhost:8080/g" \ + -e "s&OH_API_PID&$OH_API_PID&g" \ + $SET_FILE.dist cp -f $SET_FILE.dist $SET_FILE fi }