Comments are deleted in Stacks Environments #44

Closed
opened 2025-10-31 15:00:34 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @FibreTTP on GitHub (Sep 8, 2024).

When saving a Stacks Environment configuration, any lines beginning with # are deleted. Empty lines are additionally deleted:

# Test comment

test=variable

to just

test=variable

As far as I know, lines beginning with # are ignored by Docker, so there's no reason to be deleting them. This doesn't happen in the Compose file section.

Originally created by @FibreTTP on GitHub (Sep 8, 2024). When saving a Stacks Environment configuration, any lines beginning with `#` are deleted. Empty lines are additionally deleted: ``` # Test comment test=variable ``` to just ``` test=variable ``` As far as I know, lines beginning with `#` are ignored by Docker, so there's no reason to be deleting them. This doesn't happen in the Compose file section.
GiteaMirror added the done label 2025-10-31 15:00:34 -05:00
Author
Owner

@mbecker20 commented on GitHub (Sep 9, 2024):

This is not the reason, Env variables are internally not stored in file form but rather converted to array form: Array<{ variable: string, value: string }>.

This form allows for better diffing when using resource syncs. Ie the diff can show just one variables value has changed.

The config.environment defined in resource syncs do support full line comments using either # or //

@mbecker20 commented on GitHub (Sep 9, 2024): This is not the reason, Env variables are internally not stored in file form but rather converted to array form: `Array<{ variable: string, value: string }>`. This form allows for better diffing when using resource syncs. Ie the diff can show just one variables value has changed. The `config.environment` defined in resource syncs do support full line comments using either # or //
Author
Owner

@FibreTTP commented on GitHub (Sep 9, 2024):

It's a bit misleading given that there's an option for the filename directly below.

Not everyone has the need to use Resource Syncs. I suggest changing this to store the field as entered, and IF a Sync updates the variables, parse for the variables and remove the comments at that time. This wouldn't affect functionality for anyone, you can still perform the diff.

@FibreTTP commented on GitHub (Sep 9, 2024): It's a bit misleading given that there's an option for the filename directly below. Not everyone has the need to use Resource Syncs. I suggest changing this to store the field as entered, and ***IF*** a Sync updates the variables, parse for the variables and remove the comments at *that* time. This wouldn't affect functionality for anyone, you can still perform the diff.
Author
Owner

@mbecker20 commented on GitHub (Sep 9, 2024):

I considered this, however the code complexity would be high. Of course like most feedback I do see the value here and would like to deliver. But it has to be clean and not increase complexity too much or risk more bugs.

@mbecker20 commented on GitHub (Sep 9, 2024): I considered this, however the code complexity would be high. Of course like most feedback I do see the value here and would like to deliver. But it has to be clean and not increase complexity too much or risk more bugs.
Author
Owner

@mbecker20 commented on GitHub (Sep 26, 2024):

I figured this out, next release will keep your Env file with comments intact

@mbecker20 commented on GitHub (Sep 26, 2024): I figured this out, next release will keep your Env file with comments intact
Author
Owner

@Twilek-de commented on GitHub (Apr 28, 2025):

I am still seeing that comments are deleted when saving the .enf file. @mbecker20 I do not understand the confing.environment sync post here. What do I have to set up to have comments remain intact in the .env file? You might consider by the way to include your own comment in the generated .env file like "Generated by Komodo"

@Twilek-de commented on GitHub (Apr 28, 2025): I am still seeing that comments are deleted when saving the .enf file. @mbecker20 I do not understand the confing.environment sync post here. What do I have to set up to have comments remain intact in the .env file? You might consider by the way to include your own comment in the generated .env file like "Generated by Komodo"
Author
Owner

@mbecker20 commented on GitHub (Apr 29, 2025):

It saves the comments you make in the Environment section in the ui. At deploy time they are parsed and written to host, this is so multiple formats can be supported like using : instead of = . Maybe there could be an option to write it as is instead.

@mbecker20 commented on GitHub (Apr 29, 2025): It saves the comments you make in the Environment section in the ui. At deploy time they are parsed and written to host, this is so multiple formats can be supported like using : instead of = . Maybe there could be an option to write it as is instead.
Author
Owner

@Twilek-de commented on GitHub (Apr 29, 2025):

I think that would be nice. As there is often important information in the comments. If Komodo fails for some reason or someone does not want to use Komodo anymore, all this extra information would be lost for all stacks or would have to be painstakingly recovered.

@Twilek-de commented on GitHub (Apr 29, 2025): I think that would be nice. As there is often important information in the comments. If Komodo fails for some reason or someone does not want to use Komodo anymore, all this extra information would be lost for all stacks or would have to be painstakingly recovered.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#44