-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from ECN/staging
v1.1 RC
- Loading branch information
Showing
46 changed files
with
5,132 additions
and
1,089 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
The configuration of webqueue2api can be managed in two different ways: | ||
|
||
- At launch with a configuration file in the same directory as the virtual environment | ||
- At runtime by modifying the `webqueue2api.config` symbol directly | ||
|
||
## Configuration File | ||
On import, a [ConfigParser INI formatted file](https://docs.python.org/3/library/configparser.html#supported-ini-file-structure) is read for configuartion options. This file must be located in the same directory as the virtual environment folder and must be named `webqueue2api_config.ini`. | ||
|
||
!!! example "A Full Config File" | ||
```ini | ||
[parser] | ||
# Absolute path to directory containing queue data. | ||
# Default: /home/pier/e/queue/Mail | ||
queue_directory = /etc/queue-cli/queues | ||
|
||
# List of queues to ignore. (Comma and space ", " delimited.) | ||
# Default: archives, drafts, inbox, coral | ||
queues_to_ignore = dogs, cats, particularly_pugs | ||
|
||
[api] | ||
# Runtime configuration for secure production or convenient development settings. | ||
# Valid options are: prod | dev | ||
# Default: prod | ||
environment = dev | ||
|
||
# Token used to encrypt JWT payloads. | ||
# Default: webqueue2api.api.config.generate_random_string | ||
jwt_secret_key = uV0liG9$YgcGE7J! | ||
``` | ||
|
||
## Changing Settings at Runtime | ||
Each package contains package level configuration objects (see: [dataclasses on PyPI](https://pypi.org/project/dataclasses/)) in `config.py` files. All of the configurations are combined into the top level `webqueue2api.config` symbol. | ||
|
||
These configuration objects store default values for each package. Default values can be changed by editing these objects directly or by editing the object values before their use. | ||
|
||
!!! example "Changing the parser's queue directory by editing object values." | ||
```python | ||
import webqueue2api | ||
|
||
# Load Queue from default directory | ||
ce_queue = Queue("ce") | ||
|
||
# load Queue from modified directory | ||
webqueue2api.config.parser.queue_directory = "/absolute/path" | ||
other_queue = Queue("other") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.