
echo ***** generate conf file for nginx *****
set prj_path=%~dp0
set "prj_path=%prj_path:\env\nginx-1.18.0=%"

echo %prj_path%

set strFilePath=%prj_path%env\nginx-1.18.0\conf\nginx.conf.obpm
set cnfFilePath=%prj_path%env\nginx-1.18.0\conf\nginx.conf

set strOld=${static_path}
set strNew=%prj_path%obpm-static-war/target/static
set "strNew=%strNew:\=/%"
echo %strNew%

set "var=%var:/=//%"
 
setlocal enabledelayedexpansion
for /f "tokens=*" %%i in (%strFilePath%) do (
  set "var=%%i"
  if not !var!.==. (
    set "var=!var:%strOld%=%strNew%!"
    echo !var!!>>%strFilePath%.bk
  )
)
 
move /y %strFilePath%.bk %cnfFilePath%