Config in simple-run
falahati opened this issue · 3 comments
We need a way to pass a config file in simple-run
or to pass the secret via the usual run
at least.
Otherwise, we end up having to implement every single config option as a parameter for simple-run
.
For example, I personally need tolerate-time-skewness
while being able to pass at least the secret via the parameter. Currently, there is no way to do this.
Least we can do is to have a default config file and read it regardless of the starting mode.
There is no need to pas config file for simple-run
, there is run
for that purpose. Will it work for your usecase?
Hey Sergey,
well, that is in fact the problem. why do we have two separate execution methods instead of just allowing parameters to override the config?
Ok, let me describe my situation here to justify my thinking as to why we need a new parameter:
I am trying to run the application in a docker container now and I want to set the secret via an environment variable. However, I also want to increase the tolerate-time-skewness
for this container.
This combination means that I can not use simple-run
(as I can't change the tolerate-time-skewness
) and I also can't use the run
execution mode since then I can not inject the passed secret into the config file. Currently, I have to generate the config using a config template on runtime to achieve this.
I understand that some applications require complex configurations that can only be done by templating, but this app isn't really one of them.
So I think that the simplest way to solve this inconvenience without breaking compatibility is to add a new config file parameter to simple-run
.
I understand that some applications require complex configurations that can only be done by templating, but this app isn't really one of them.
When I've designed this app, my goal was to get rid of Go's way of passing myriads of cli arguments in a favor of a better-structured config file. I do not think it is a good idea to have overrides as cli parameters or environment variables because it will make both modes almost the same.
simple-run
is fire-and-forget that is going to cover about 90 percents of actual usages. run
should work in 100% of cases.
Will it work if I introduce a special syntax in config file that will take secret from envrionment variable? Like:
secret = "-"
So, secret is going to be carved out from MTG_SECRET
environment variable? This is compromise, I believe, we can both tolerate.