txoof/PaperPi

How to determine which config file is being accessed

Closed this issue · 1 comments

txoof commented

There are four potential sources for a config file:

  1. ./paperpi/config/paperpi_cfg.json - this file is always included to ensure that any missing configuration keys that the user may have deleted are accounted for.
  2. ~/.config/com.txoof.paperpi/paperpi_cfg.json - this is included when running in on-demand mode
  3. /etc/defaults/paperpi_cfg.json - this is included when running in daemon mode
  4. USER SUPPLIED - this set on the command line using the -c switch

Config file 1 should never ever be touched. It should be considered immutable as it is the default "blank" template for all installations and user config files.

Config file 2 should be used when config['main']['daemon'] == False

Config file 3 should be used when config['main']['dameon'] == True

config file 4 should be used when cmd_args.options.user_config != None

Config file #4 is the most problematic -- perhaps this needs to be redone.

txoof commented

used config files are provided by get_config_files() function as part of the return value - See PR #138