Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make config file configurable #259

Open
mkoskar opened this issue Dec 10, 2019 · 3 comments
Open

Make config file configurable #259

mkoskar opened this issue Dec 10, 2019 · 3 comments

Comments

@mkoskar
Copy link

mkoskar commented Dec 10, 2019

Right now config file is hardcoded to be $XDG_CONFIG(~/.config if not defined)/afew/config. In usecases concerning multiple notmuch dbs this is preventing to have separate configuration per db.

I've solved it with following quick and dirty solution introducing AFEW_CONFIG environment variable:

diff --git a/afew/Settings.py b/afew/Settings.py
index 44d6f3c..b37154e 100644
--- a/afew/Settings.py
+++ b/afew/Settings.py
@@ -19,7 +19,7 @@ settings = ConfigParser()
 settings.optionxform = str
 
 settings.readfp(open(os.path.join(os.path.dirname(__file__), 'defaults', 'afew.config')))
-settings.read(os.path.join(user_config_dir, 'config'))
+settings.read(os.environ.get('AFEW_CONFIG', os.path.join(user_config_dir, 'config')))
 
 # All the values for keys listed here are interpreted as ;-delimited lists
 value_is_a_list = ['tags', 'tags_blacklist']

I guess it would be nicer if there were also accompanying argparse() parameter (probably -c). I haven't got around to do it myself mainly because it would need refactoring of Settings.py code which does parsing of settings on import.

If above is acceptable for now let me know and I'll make it as PR, probably mentioning it in man page would be good too.

@madic-creates
Copy link

Is a configurable config file still considered?

@GuillaumeSeren
Copy link
Collaborator

Hey,
I don't think there is a PR around this one, someone should open one 🚀

@Vinfall
Copy link

Vinfall commented Nov 14, 2022

There is #307 hanging for a year now, any update or possibility to merge that? I don't see why it has no reply yet all other open PRs have some sort of review.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants