这是indexloc提供的服务,不要输入任何密码
Skip to content

loadConfigsFromEnvFiles does not ignore comments in file configs #373

@aerz

Description

@aerz

Describe the bug

I use files to configure multiple backups. I tried to update from v2.35.0 to the latest v2.38.0 and got the following error when loading any config file:

time=2024-02-23T15:27:18.915Z level=ERROR msg="Fatal error running command: unexpected command substitution at 1:3" error="main.(*command).runInForeground: error scheduling: main.(*command).schedule: error sourcing configuration: main.sourceConfiguration: error loading config files: main.loadConfigsFromEnvFiles: error reading config file /etc/dockervolumebackup/conf.d/test.backup.env: main.source: error expanding env: unexpected command substitution at 1:3"

Trying to figure out what is happening and a minimal way to replicate it, I found that in all my files I have comments with example variable usage, in the same way as it is done in the docs which causes the read error but was previously ignored.

Comment line is similar to:

# e.g. `backup-$HOSTNAME-%Y-%m-%dT%H-%M-%S.tar.gz`. Expansion happens before`

Or:

# `docker-volume-backup.stop-during-backup=service1`

Comments after setting a variable works:

BACKUP_CRON_EXPRESSION="15 6 */3 * *" # At 06:15 on every 3rd day-of-month

I could get it working as expected by removing all comment lines.

Expected behavior

All lines beginning with # are comments and are ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions