Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config in simple-run #288

Open
falahati opened this issue Nov 14, 2022 · 3 comments
Open

Config in simple-run #288

falahati opened this issue Nov 14, 2022 · 3 comments

Comments

@falahati
Copy link

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.

@9seconds
Copy link
Owner

There is no need to pas config file for simple-run, there is run for that purpose. Will it work for your usecase?

@falahati
Copy link
Author

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.

@9seconds
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants