Closed vadimklimov closed 4 months ago
Thanks for sharing your idea on this. Haven't considered this use case, but it definitely makes sense ๐๐ป
Would you be interested to make the required changes and contribute them to the repository? ๐
I think not all parameters need Shell expansions, so it's probably better having a separate function that is only called where it is needed. When handling Shell expansions, it'll probably be important to validate them as described in issue https://github.com/engswee/flashpipe/issues/3
Thank you for your comments @engswee. I have submitted a pull request #33 for this change.
When passing configuration parameters as flags to the FlashPipe CLI, it is finely possible to use environment variables as parts of the configuration parameters' values as they will get transparently substituted with corresponding environment variables' values with the help of Shell expansions.
In contrast, when sourcing configuration from the configuration file, Shell expansions don't get executed and configuration parameters' values are read as-is.
Example: set
$TMPDIR/flashpipe
value for thedir-work
configuration parameter, or$HOME/workspace/cpi-tenant
value for thedir-git-repo
configuration parameter - firstly, using CLI arguments, and then using the configuration file.I can think of parameter and variable expansions as those that can become convenient, but this can further include some other Shell expansions - for example, tilde expansion, to reference the
$HOME
directory.If such behaviour is not intended to be applied to configuration parameters' values when using the configuration file, then it may be worth mentioning this in the documentation.
On the other hand, if such an enhancement makes sense here, then environment variables expansion can be added with the help of
os.ExpandEnv()
. It may extend the existing implementation ofconfig.GetString()
functions. Or, not to mix it with existingconfig.Get*()
functions, it may get implemented in a dedicated util function.