mbecker20 / komodo

🦎 a tool to build and deploy software on many servers 🦎
https://komo.do
GNU General Public License v3.0
1.74k stars 34 forks source link

Comments are deleted in Stacks Environments #63

Closed FibreTTP closed 4 weeks ago

FibreTTP commented 1 month ago

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.

mbecker20 commented 1 month ago

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 //

FibreTTP commented 1 month ago

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.

mbecker20 commented 1 month ago

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 1 month ago

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