jdrumgoole commented on issue #82: URL: https://github.com/apache/otava/issues/82#issuecomment-3145762373
I think the most common approach is: Command line args > environment variables > config files > defaults within the code. ConfigArgParser follows this pattern. So +1 for that idea. Joe Drumgoole +087 2995547 https://bsky.app/profile/joedrumgoole.com On Fri 1 Aug 2025, 14:48 Henrik Ingo, ***@***.***> wrote: > *henrikingo* created an issue (apache/otava#82) > <https://github.com/apache/otava/issues/82> > > Note that this is a generalisation of #65 > <https://github.com/apache/otava/issues/65> . > > If a user, particularly a new user, has not created a configuration file > for otava, they will default to reading the one supplied in > otava/resources/otava.yml. > > That file uses some kind of template variables (jinja2?), such as > ${GRAFANA_ADDRESS}. This allows the user to define these values as > environment variables and have them interpolated into the yaml file > eventually. However, this has the unintended consequence that all of the > variables in this default yaml file are now required. > > *Workaround* : Just supply dummy values in the corresponding environment > variables. Or, create your own otava.yaml file with minimal configuration. > In that case the default file will never be read and this problem is > avoided. (This is the common path.) > > *Proposed solution*: IMO mixing environment variables into the yaml file > configuration is the problem here. The correct way to support environment > variables in my opinion is to read them and the yaml options separately, > then merge them in some well defined priority order. > > My personal preference would be to user ConfigArgParse > <https://pypi.org/project/ConfigArgParse/> and support all options in the > same library. (CLI options, yaml file, > > — > Reply to this email directly, view it on GitHub > <https://github.com/apache/otava/issues/82>, or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAAXYDTA2FE7FXXSGVSZQKT3LNV2JAVCNFSM6AAAAACC42JLQCVHI2DSMVQWIX3LMV43ASLTON2WKOZTGI4DIMBRGIYDQNQ> > . > You are receiving this because you are subscribed to this thread.Message > ID: ***@***.***> > -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
