Open em411 opened 2 days ago
Reminds me of #28
Default vars and global vars, while seemingly similar, serve distinct purposes and would complement each other rather than be interchangeable.
Default vars act as a template/preset for new stack initialization, where users expect to modify values per stack's specific needs. For example, having a default value for DOMAIN
pointing to internal domain name is useful as a starting point, but some stacks will need to change it to external domain for public facing services. The main difference is that updating default vars doesn't affect existing stacks - it only applies to new ones, making it a simpler, more predictable feature.
Global vars, on the other hand, should function (in my opinion) as a singleton that affects all stacks uniformly, both existing and new. When you update a global var, the change propagates automatically across all stacks, making it a more complex feature that requires proper state management and update handling. This behavior is essential for values that should remain consistent across your application, like API keys or base path for bind mount directory.
Another advantage of default vars is that they serve as documentation of common configuration patterns. Users can quickly understand the expected environment structure by looking at the default template, while still maintaining the freedom to adjust values as needed.
In essence, default vars focus on initialization convenience while preserving stack independence, whereas global vars emphasize unified configuration management across all stacks.
Yeah I understand. I realize there is an existing usage pattern available that should satisfy your use case and more, call it the template pattern.
You may have noticed every Resource in Komodo has a "Copy" button available, you just enter a new name and it keep the same config. You can leverage this by creating template resources thats only use is as the source resource with the Copy api.
For example, create a new Deployment just called "template", and add the environment variables you want as defaults there. When you want to create a new Deployment, just navigate to the template use the Copy button.
While it is slightly less convenient to have to navigate to the template before creation, I don't think this impact is big (it takes seconds using the Search). Additionally, this pattern has several advantages:
Network
, Restart Mode
, or Labels
.You can also leverage the simple API available for all resources to create new resources from template resources for automations, for example can use this call in an Action:
komodo.write("CopyDeployment", { name: "my-new-deployment", id: "template" })
Overall I think universal configurable defaults is not adding enough value to justify this feature in addition to the template pattern. Please try out this pattern for your use case and let me know any difficulties you come across, and we can re-asses how to make this process more straightforward.
Already I see one way, which I will implement: When you click "New ..." buttons, currently you input the Name and hit create. Right below the name, can have a selector allowing to choose from your resources to copy from. Can also mark a resource as default for the template. The flow of this solution should be very similar to what you are looking for.
Description
Currently, when creating a new stack in Komodo, the Environment form section provides a basic placeholder format
# VARIABLE = value
. While this is helpful for beginners, it's not so useful for advanced users who frequently use the same environment variables across different stacks.Suggested Solution
Add a "Default" checkbox option in the variables settings that allows users to:
Use Case
PUID
,PGID
, orTZ
can be presetExample images