Skip to content

Nacos 3.0.0 startup error in windows environment #13335

@xingguang2013

Description

@xingguang2013

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.keynacos.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:

  1. Go to download
  2. Download and decompress nacos-server-3.0.0.zip
  3. Configure nacos.core.auth.plugin.nacos.token.secret.keynacos.core.auth.server.identity.key and nacos.cre.auth.server.identity.value in the application.properties
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions