Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Using unquoted spaced value for environment variable fail #506

Closed
convexshiba opened this issue Jun 23, 2024 · 1 comment · Fixed by #507
Closed

[BUG] Using unquoted spaced value for environment variable fail #506

convexshiba opened this issue Jun 23, 2024 · 1 comment · Fixed by #507
Assignees
Labels
enhancement New feature or request waiting for user response Marked when devs waiting for reply from user.

Comments

@convexshiba
Copy link

convexshiba commented Jun 23, 2024

Describe the bug

In Webui, change cron expression for import from every 45 to every 15 min

click save leads to

[2024-06-23T16:19:50.638774-07:00] http.INFO: 192.168.50.207 - "POST /v1/api/system/env/WS_CRON_PROGRESS_AT HTTP/1.1" 200 119 "http://192.168.50.50:34213/env" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" "-" [] []
HTTP: Exception 'Symfony\Component\Dotenv\Exception\FormatException' was thrown unhandled during HTTP boot context. Error 'A value containing spaces must be surrounded by quotes in "/config/config/.env" at line 7.
...RESS_AT=*/15 * * * *\n...
                      ^ line 7 offset 170 @ /vendor/symfony/dotenv/Dotenv.php:546'.

Webui no longer loads

To Reproduce

Expected behavior

Screenshots

image

Basic report

Paste the system:report output here

Additional context

Seems the .env is stored as:

WS_CRON_PROGRESS_AT=*/15 * * * *

Changing to

WS_CRON_PROGRESS_AT="*/15 * * * *"

fixes it

@arabcoders arabcoders self-assigned this Jun 24, 2024
@arabcoders arabcoders added enhancement New feature or request labels Jun 24, 2024
@arabcoders
Copy link
Owner

Hi @convexshiba,

This is as expected, as our underlying env parser library doesn't support unquoted spaced values.

However, the library while nice to have we barely use any of it features, we simply just load them using it, as such i dropped it and replaced it with a local implementation that does support unquoted spaced string, as it's simple line by line parser.

However due to removing this library we lost the following features in env file parsing:

  • mutli-line values.
  • shell expansion variables. WS_TMP_DIR=${WS_TMP_DIR:-WS_DATA_PATH}/tmp_files
  • strict line by line debugger.

While we really don't use any of them, it's good idea to document this in case we later need to know why something doesn't work.

The mentioned changes are happening right now in the dev branch via #507 PR.

@arabcoders arabcoders added the waiting for user response Marked when devs waiting for reply from user. label Jun 24, 2024
@arabcoders arabcoders changed the title [BUG] Changing cron expression leads to issue [BUG] Using a env variable with space in value cause the parser to fail. Jun 24, 2024
@arabcoders arabcoders changed the title [BUG] Using a env variable with space in value cause the parser to fail. [BUG] Using unquoted spaced value for environment variable fail Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting for user response Marked when devs waiting for reply from user.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants