-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Description
Describe the bug
After download and decompress, start directly with the command startup.cmd - m standalone
. If you follow the instructions on the official website, you need to enter three parameters nacos.core.auth.plugin.nacos.token.secret.key
、nacos.core.auth.server.identity.key
and nacos.core.auth.server.identity.value
,this is not a problem, but if you configure it directly in the application.properties
file, it will still prompt you to enter the above parameters when restarted.
Expected behavior
Follow the instructions on the official website, if you configure it directly in the application.properties
file, It should not need to enter these three parameters at startup.
Actually behavior
You configure it directly in the application.properties
file, it will still prompt you to enter the above parameters when restarted.
How to Reproduce
Steps to reproduce the behavior:
- Go to download
- Download and decompress
nacos-server-3.0.0.zip
- Configure
nacos.core.auth.plugin.nacos.token.secret.key
、nacos.core.auth.server.identity.key
andnacos.cre.auth.server.identity.value
in theapplication.properties
- It will still prompt you to enter the above parameters
Desktop (please complete the following information):
- OS: Windows11
- Version: 24H2
Additional context
After reviewing the startup.cmd script, I believe the problem lies in how to determine if the values configured for these three parameters exist in the application.properties
file,
:Process_required_config
setlocal
set "key_pattern=%~1"
set "target_file=%~2"
set "target_file=!target_file:"=!"
set "escaped_key=%key_pattern:.=\.%"
findstr /R "^%escaped_key%=[ \t]*" "%target_file%" > nul
if %errorlevel% == 0 (
set /p "input_val=%key_pattern% is missing, please input: "
set "temp_file=%TEMP%\temp_%RANDOM%.tmp"
set "key_pattern_with_equal=!key_pattern!="
for /f "usebackq delims=" %%a in ("!target_file!") do (
set "line=%%a"
set "line=!line: =!"
if "!line!"=="!key_pattern_with_equal!" (
echo %%a!input_val!>>"!temp_file!"
) else (
echo %%a>>"!temp_file!"
)
)
move /Y "!temp_file!" "!target_file!" >nul
echo %key_pattern% Updated:
findstr /R "^%escaped_key%" "!target_file!"
echo ----------------------------------
)
endlocal
There is an issue with this line of code, It is still unclear how to fix it, as the findstr command in Windows cmd scripts is not yet supported [ \t]*
findstr /R "^%escaped_key%=[ \t]*" "%target_file%" > nul