@@ -6,8 +6,8 @@ Although confidence is internally divided in a number of modules, all of the fun
66# manually creating a Configuration object from a dict of values is about as
77# simple as it sounds:
88config = confidence.Configuration({
9- ' service.host' : ' example.com' ,
10- ' service.port' : 443 ,
9+ ' service.host' : ' example.com' ,
10+ ' service.port' : 443 ,
1111})
1212# suppose there's a function connect that takes two arguments
1313# we can connect to the configured host and port as such:
@@ -41,3 +41,31 @@ config = confidence.loadf('path/to/file.yaml')
4141# the result is the same as the example above, we can use config.service like we would a dict
4242connection = connect(** config.service)
4343```
44+
45+ ## Reading from multiple files
46+
47+ If you split your configuration over multiple files as they contain configuration for different things,
48+ like a service to connect to and some local paths to store data, confidence can load them both as if they were one:
49+
50+ ``` yaml
51+ # some system-wide configuration in /etc/paths.yaml
52+ paths :
53+ data : /storage/data
54+ backup : /mnt/backup/data
55+ ` ` `
56+
57+ ` ` ` yaml
58+ # service configuration as before, stored in path/to/service.yaml
59+ service.host : example.com
60+ service.port : 443
61+ ` ` `
62+
63+ ` ` ` python
64+ # loadf can take multiple files, the contents of which are combined into a
65+ # single Configuration object
66+ config = confidence.loadf('/etc/paths.yaml', 'path/to/service.yaml')
67+ # there's still something to connect to the service
68+ connection = connect(**config.service)
69+ # and some extra things that configure the place to backup to
70+ connection.backup_to(config.paths.backup)
71+ ```
0 commit comments