go-jira / jira

simple jira command line client in Go
Apache License 2.0
2.66k stars 323 forks source link

Config file driven by environment variable #489

Open cmaahs opened 1 year ago

cmaahs commented 1 year ago

This may simply be unique to my use case, though I thought I'd share in case it someone else might find it useful.

I work on multiple Jira systems. And use the go-jira tool extensively. My initial method was to just copy a <system>-config named file to config.yml in order to effectively switch between the Jira systems / boards.

This of course switches every session at once, which is undesirable. So I added code to look at GOJIRA_CONFIG environment variable and use that to prefix the config.yaml -> ${GOJIRA_CONFIG}-config.yml. Of course one could instead use a full path to the config file.

Clearly easy enough to implement, here is the diff on my fork: https://github.com/cmaahs/jira/compare/master...cmaahs:jira:maahs?expand=1