adding latest + initial design patterns text file

This commit is contained in:
2019-12-05 03:53:50 +00:00
parent 5d855abbee
commit b45c030c59
14 changed files with 458 additions and 62 deletions

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "plex-posters"
version = "0.1.4"
version = "0.1.5"
description = ""
authors = ["dtomlinson <dtomlinson@panaetius.co.uk>"]

View File

@@ -25,21 +25,22 @@ class Config:
module_name : str
A string representing the module name. This is added in front of all
envrionment variables and is the title of the `config.toml`.
Parameters
----------
path : str
Path to config file
"""
def __init__(self, path: str) -> None:
"""
Parameters
----------
path : str
Path to config file
See :class:`~plex_posters.config.config.Config` for parameters.
"""
self.config_file = self.read_config(path)
self.module_name = header.lower()
self.deferred_messages = []
def read_config(self, path: str) -> Union[dict, None]:
"""Reads the toml config file from `path` if it exists.
Parameters
@@ -109,6 +110,7 @@ class Config:
"""
env_key = f"{header}_{key.upper().replace('.', '_')}"
# self.defer_log(self.config_file)
try:
# look in the config.toml
section, name = key.lower().split('.')
@@ -119,8 +121,10 @@ class Config:
self.defer_log(f'{env_key} not found in config.toml')
except TypeError:
pass
# look for an environment variable
value = os.environ.get(env_key)
if value is not None:
self.defer_log(f'{env_key} found in an environment variable')
else: