txoof / PaperPi

E-Paper display loop with plugins
100 stars 10 forks source link

How to determine which config file is being accessed #133

Closed txoof closed 1 year ago

txoof commented 1 year ago

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 1 year ago

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