infeeeee / kimai2-cmd

Command line client for Kimai2, the open source, self-hosted time tracker
MIT License
24 stars 6 forks source link

Add config environment variable #17

Closed Madic- closed 3 years ago

Madic- commented 3 years ago

Could you add an environment variable, e.g. KIMAI_CONFIG, which stores the path to the settings.ini? Then kimai2-cmd could first search for the settings.ini in the path provided by KIMAI_CONFIG and then in its own folder.

With an environment variable I could do something like this: export KIMAI_CONFIG=$XDG_CONFIG_HOME/kimai2

infeeeee commented 3 years ago

Added support in #18. Also added info to readme, new builds are up soon.

One little difference from your request. You have to add a full path to settings.ini. This way you can even store it in a differently named file, e.g. kimai2.ini. Your export should look something like this:

export KIMAI_CONFIG=$XDG_CONFIG_HOME/kimai2/settings.ini

The first run doesn't create it for you to this location, so you will have to copy it to your custom location after created or from the example file.