News for hackers. Stuff that matters.
Re:Everything that uses configuration files should report wh... by bayindirh on Sunday June 25, 2023 @11:31AM (#36469266)
If you pass -verbose switch to any of my programs you'll definitely see a line similar to this:

    verbose: Configuration file found at $PATH.
There are a couple of places I look for my config files: /etc, ~/.config and "./conf", at that order. The last one accelerates testing a great deal.

And every configuration that overrides the built-in defaults are reported one by one.

Also, I started to detail how configuration file works in README.md file, under its section now.

Lastly, I decided to fix all of my tools to work on same specs from now on, regardless of the programming language they're written in:

1. Use TOML, and TOML only.

2. Config file overrides the defaults, Command line flags overrides the configuration file.

Re:Everything that uses configuration files should report wh... by cperciva on Sunday June 25, 2023 @12:33PM (#36469980)
Config file overrides the defaults, Command line flags overrides the configuration file.

Don't forget "user configuration file overrides system configuration file (but is overridden by command line)".

In tarsnap the priority (lowest wins) is:

0: Command line

1: ~/.tarsnaprc

2: /etc/tarsnap.conf (may be in a different system etc depending on platform standards)

3: tarsnap defaults.

Re:Everything that uses configuration files should report wh... by spc476 on Sunday June 25, 2023 @01:05PM (#36470354)
Where would configuration options via environment variables fit in? I can see between 0 and 1, or 1 and 2, but can't quite decide which is better.
Re:Everything that uses configuration files should report wh... by cperciva on Sunday June 25, 2023 @01:38PM (#36470753)
Not relevant to tarsnap (and in general something I would be very careful about adding since people often don't realize what's in their environment) but I would say that command line options take priority over the environment and the environment takes priority over all configuration files.
Re:Everything that uses configuration files should report wh... by CoolCold on Monday June 26, 2023 @06:53AM (#36478077)
+1 on both points - support for env and handling env priority