uchicago-library / attachment-converter

Attachment Converter: tool for batch converting attachments in an email mailbox
GNU General Public License v2.0
8 stars 3 forks source link

Config file should be in several canonical places #66

Closed bufordrat closed 1 year ago

bufordrat commented 1 year ago

Currently, Attachment Converter looks for the config file (.config) in the current working directory, i.e. the directory where it is run from. This is ok for simple testing, but in practice, the user is going to be running it from wherever they run it from---and where they run it from certainly shouldn't affect the configuration it uses!

The standard approach in these situations is for a command-line tool to look for the configuration file in a couple canonical places. As a first stab, perhaps we could have Attachment Converter check for these locations in descending order:

waclena commented 1 year ago

Matt Teichman @.***> writes:

Currently, Attachment Converter looks for the config file (.config) in the current working directory, i.e. the directory where it is run from. This is ok for simple testing, but in practice, the user is going to be running it from wherever they run it from---and where they run it from certainly shouldn't affect the configuration it uses!

The standard approach in these situations is for a command-line tool to look for the configuration file in a couple canonical places. As a first stab, perhaps we could have Attachment Converter check for these locations in descending order:

  • a path specified on the command line (for example: attachment-converter --single-email --config=~/my-config-files/.acrc)
  • a path given by a shell environment variable called something like $AC_CONFIG
  • something in the .config directory, which is where a lot of UNIX applications keep their configuration files, so: ~/.config/attachment-converter/acrc
  • ~/.acrc
  • if no config file exists at any of these paths, Attachment Converter should likely default to using a hardcoded configuration, perhaps a constant defined in configuration.ml

I think ".config" is too generic a name and should be changed (.acconfig? .attachment_converter_rc? (gulp) .mimosrc?).

bufordrat commented 1 year ago

The name I had in mind was .acrc. ~/.config is a general purpose directory that a lot of applications (including herbstluftwm, fish, audacity, and many others, I think) use to store their config files by default.