beetbox / beetbox/confuse

Import secondary configuration files

Open
#40 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
424
Forks
57
PR merge metrics
No merged PRs in 30d

Description

I read in other issues the opinion that there should be one configuration file, and the rest be data. I have a counterexample to that.

I currently need user-switchable configurations for what the app will be doing as the main configuration file. There will be sample configurations for different tasks that users can easily copy. Independently of that, I want database configuration that will not be modified that often. Consequently, I expect to have `config.yaml` and `db.yaml` in my `.config/APPNAME` directory. So currently I have something like this:

```
config = confuse.Configuration(APPNAME, __name__)
try:
_db_config_name = os.path.join(config.config_dir(), 'db.yaml')
config['db'].set(confuse.ConfigSource(confuse.load_yaml(_db_config_name), _db_config_name))
except confuse.ConfigReadError:
pass
```

However, it feels like I'm doing something dirty. :) Is there a better way to do something like this?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.