Sometimes variables in .env contain # so the fix to remove end comment breaks them #524

Closed
opened 2023-10-23 17:23:14 +00:00 by cas · 3 comments
Owner

The fix to pkg/config/env.go which strips end comments breaks for example the matrix-synapse recipe where an auto-join room variable where a channel name is specified as "#example:example.net".

(we had to work around this by removing the fix temporarily to deploy a matrix-synapse with that configuration).

The Ideal fix would be to parse with quote semantics. A less ideal but much easier fix would be to allow escaping a # in a value with a backslash and unescaping it after stripping comments.

The fix to `pkg/config/env.go` which strips end comments breaks for example the `matrix-synapse` recipe where an auto-join room variable where a channel name is specified as `"#example:example.net"`. (we had to work around this by removing the fix temporarily to deploy a matrix-synapse with that configuration). The Ideal fix would be to parse with quote semantics. A less ideal but much easier fix would be to allow escaping a # in a value with a backslash and unescaping it after stripping comments.
cas added the
bug
label 2023-10-23 17:23:14 +00:00
decentral1se added the
abra
label 2023-10-28 12:14:59 +00:00
Member

I stumbled across the same bug. But I'm a bit confused, why this fix be693e9df0 is necessary at all?? abra uses the godotenv library and according to the README it can handle comments.
I would favor to rely on a robust library to parse env files instead of hacks like splitting the line by #

I stumbled across the same bug. But I'm a bit confused, why this fix https://git.coopcloud.tech/coop-cloud/abra/commit/be693e9df09b567f53b2402cbc2a689094369692 is necessary at all?? `abra` uses the `godotenv` library and according to the README it can handle comments. I would favor to rely on a robust library to parse env files instead of hacks like splitting the line by `#`
Member

I don't think comment removal and modifier parsing can be implemented correctly while using the godotenv. We either have to fork it (actually abra already uses a fork) or add the env parsing to abra. See also#535 (sorry didn't see this issue bevore creating the new one)

I would favor to rely on a robust library to parse env files instead of hacks like splitting the line by #

I have the feeling, that using env files is comming to a limit here (without using hacks like modifiers as comments). Using a more structured file format like yaml could solve the problem better i think. This is probably not possible since it would break everything

I don't think comment removal and modifier parsing can be implemented correctly while using the `godotenv`. We either have to fork it (actually abra already uses a fork) or add the env parsing to abra. See also#535 (sorry didn't see this issue bevore creating the new one) > I would favor to rely on a robust library to parse env files instead of hacks like splitting the line by # I have the feeling, that using env files is comming to a limit here (without using hacks like modifiers as comments). Using a more structured file format like yaml could solve the problem better i think. This is probably not possible since it would break everything
Owner

also reported in #535 (comment), gonna close this one

also reported in https://git.coopcloud.tech/coop-cloud/organising/issues/535#issuecomment-18921, gonna close this one
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coop-cloud/organising#524
No description provided.