Luke Tainton
9830c5cc3a
* chore(pip-prod)(deps): bump pyparsing from 3.1.1 to 3.1.2 Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 3.1.1 to 3.1.2. - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/master/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/3.1.1...pyparsing_3.1.2) --- updated-dependencies: - dependency-name: pyparsing dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump packaging from 23.2 to 24.0 Bumps [packaging](https://github.com/pypa/packaging) from 23.2 to 24.0. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/23.2...24.0) --- updated-dependencies: - dependency-name: packaging dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore(actions)(deps): bump mathieudutour/github-tag-action Bumps [mathieudutour/github-tag-action](https://github.com/mathieudutour/github-tag-action) from 6.1 to 6.2. - [Release notes](https://github.com/mathieudutour/github-tag-action/releases) - [Commits](https://github.com/mathieudutour/github-tag-action/compare/v6.1...v6.2) --- updated-dependencies: - dependency-name: mathieudutour/github-tag-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump autopep8 from 2.0.4 to 2.1.0 Bumps [autopep8](https://github.com/hhatto/autopep8) from 2.0.4 to 2.1.0. - [Release notes](https://github.com/hhatto/autopep8/releases) - [Commits](https://github.com/hhatto/autopep8/compare/v2.0.4...v2.1.0) --- updated-dependencies: - dependency-name: autopep8 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump filelock from 3.13.1 to 3.13.2 Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.13.1 to 3.13.2. - [Release notes](https://github.com/tox-dev/py-filelock/releases) - [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/py-filelock/compare/3.13.1...3.13.2) --- updated-dependencies: - dependency-name: filelock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump filelock from 3.13.2 to 3.13.3 Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.13.2 to 3.13.3. - [Release notes](https://github.com/tox-dev/py-filelock/releases) - [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/py-filelock/compare/3.13.2...3.13.3) --- updated-dependencies: - dependency-name: filelock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump filelock from 3.13.3 to 3.13.4 Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.13.3 to 3.13.4. - [Release notes](https://github.com/tox-dev/py-filelock/releases) - [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/py-filelock/compare/3.13.3...3.13.4) --- updated-dependencies: - dependency-name: filelock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump idna from 3.6 to 3.7 Bumps [idna](https://github.com/kjd/idna) from 3.6 to 3.7. - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst) - [Commits](https://github.com/kjd/idna/compare/v3.6...v3.7) --- updated-dependencies: - dependency-name: idna dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore(pip-prod)(deps): bump virtualenv from 20.25.1 to 20.25.3 Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.25.1 to 20.25.3. - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/virtualenv/compare/20.25.1...20.25.3) --- updated-dependencies: - dependency-name: virtualenv dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Add APM (#184) * Add APM * Fix unit tests * Remove apm.py * Add SonarCloud recommendations * SonarCloud python:S6890 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
67 lines
2.0 KiB
Python
67 lines
2.0 KiB
Python
"""Configuration module."""
|
|
|
|
import os
|
|
|
|
|
|
class Config:
|
|
"""Configuration module."""
|
|
def __init__(self) -> None:
|
|
"""Configuration module."""
|
|
self.__environment: str = os.environ.get("APP_LIFECYCLE", "DEV").upper()
|
|
self.__bot_name: str = os.environ["BOT_NAME"]
|
|
self.__webex_token: str = os.environ["WEBEX_API_KEY"]
|
|
self.__admin_first_name: str = os.environ["ADMIN_FIRST_NAME"]
|
|
self.__admin_emails: list = os.environ["ADMIN_EMAIL"].split(",")
|
|
self.__n8n_webhook_url: str = os.environ["N8N_WEBHOOK_URL"]
|
|
self.__sentry_dsn: str = os.environ.get("SENTRY_DSN", "")
|
|
self.__sentry_enabled: bool = bool(
|
|
os.environ.get("SENTRY_ENABLED", "False").upper() == "TRUE"
|
|
and self.__sentry_dsn != ""
|
|
)
|
|
|
|
@property
|
|
def environment(self) -> str:
|
|
"""Returns the current app lifecycle."""
|
|
return self.__environment
|
|
|
|
@property
|
|
def sentry_enabled(self) -> bool:
|
|
"""Returns True if Sentry SDK is enabled, else False."""
|
|
return self.__sentry_enabled
|
|
|
|
@property
|
|
def sentry_dsn(self) -> str:
|
|
"""Returns the Sentry DSN value if Sentry SDK is enabled AND
|
|
Sentry DSN is set, else blank string."""
|
|
if not self.__sentry_enabled:
|
|
return ""
|
|
return self.__sentry_dsn
|
|
|
|
@property
|
|
def bot_name(self) -> str:
|
|
"""Returns the bot name."""
|
|
return self.__bot_name
|
|
|
|
@property
|
|
def webex_token(self) -> str:
|
|
"""Returns the Webex API key."""
|
|
return self.__webex_token
|
|
|
|
@property
|
|
def admin_first_name(self) -> str:
|
|
"""Returns the first name of the bot admin."""
|
|
return self.__admin_first_name
|
|
|
|
@property
|
|
def admin_emails(self) -> list:
|
|
"""Returns a list of admin email addresses."""
|
|
return self.__admin_emails
|
|
|
|
@property
|
|
def n8n_webhook_url(self) -> str:
|
|
"""Returns the n8n webhook URL."""
|
|
return self.__n8n_webhook_url
|
|
|
|
|
|
config: Config = Config()
|