firefighter ¤
This is the main entrypoint for FireFighter.
Warning
This app does not contain any business logic. It is responsible for loading all the settings, providing common base features and tying together all the other apps.
Features¤
- Load all settings
- Provide
ASGI
andWSGI
entrypoints - Configure loggers
- Provide a Celery app
- Set the base URL routing
- Provides a
healthcheck
endpoint - Provide a
robots.txt
endpoint - Provides some utils
- Provides SSO integration
- Register the Django admin and customize its theme
Modules:
-
apps
– -
asgi
–ASGI config for firefighter project.
-
fields_forms_widgets
– -
filters
–Collection of custom Django template filters. They are added as built-in filters and thus can be used in templates of any app.
-
formats
–See Django docs: https://docs.djangoproject.com/en/4.2/topics/i18n/formatting/ .
-
http_client
– -
middleware
– -
settings
–This module define all the settings for the FireFighter project.
-
urls
–firefighter URL Configuration.
-
utils
– -
views
– -
wsgi
–WSGI config for firefighter project.
apps ¤
asgi ¤
ASGI config for firefighter project.
It exposes the ASGI callable as a module-level variable named application
.
For more information on this file, see https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
fields_forms_widgets ¤
Classes:
-
CustomCheckboxSelectMultiple
–Custom template.
-
FFDateRangeSingleFilter
–TODO Fix typings, implement tests, move in proper location.
-
GroupedCheckboxSelectMultiple
–Widget to group checkboxes in a select multiple.
-
TextDateRangeField
–
CustomCheckboxSelectMultiple ¤
Bases: CheckboxSelectMultiple
Custom template.
FFDateRangeSingleFilter ¤
Bases: Filter
TODO Fix typings, implement tests, move in proper location.
GroupedCheckboxSelectMultiple ¤
Bases: CustomCheckboxSelectMultiple
Widget to group checkboxes in a select multiple. TODO Make this generic!
Methods:
-
optgroups
–Return a list of optgroups for this widget.
optgroups ¤
optgroups(name: str, value: list[Any], attrs: dict[str, Any] | None = None) -> list[tuple[str | None, list[dict[str, Any]], int | None]]
Return a list of optgroups for this widget.
Source code in src/firefighter/firefighter/fields_forms_widgets.py
TextDateRangeField ¤
Bases: Field
Methods:
-
to_python
–Validate date range. Field is optional.
to_python ¤
Validate date range. Field is optional.
Source code in src/firefighter/firefighter/fields_forms_widgets.py
filters ¤
Collection of custom Django template filters. They are added as built-in filters and thus can be used in templates of any app.
Functions:
-
apply_filter
–Applies a filter function to a given value.
-
get_item
–Get the value of a key from a dictionary or object.
-
markdown
–Converts markdown-formatted text to HTML.
-
readable_time_delta
–Format a time delta as a string. Ignore seconds and microseconds
-
timedelta_chop_microseconds
–Removes microseconds from a timedelta object.
apply_filter ¤
apply_filter(value: Any, fn_holder: dict[Literal['filter_args', 'filter'], Callable[..., V]]) -> V | Any
Applies a filter function to a given value.
Parameters:
-
value
(Any
) –The value to be filtered.
-
fn_holder
(dict[Literal['filter_args', 'filter'], Callable[..., V]]
) –A dictionary containing the filter function and its arguments.
Returns:
-
V | Any
–The filtered value.
Source code in src/firefighter/firefighter/filters.py
get_item ¤
Get the value of a key from a dictionary or object.
Parameters:
-
dictionary
(dict[str, Any]
) –The dictionary or object to get the value from.
-
key
(Any
) –The key to get the value for.
Returns:
-
Any
(Any
) –The value of the key in the dictionary or object.
Source code in src/firefighter/firefighter/filters.py
markdown ¤
Converts markdown-formatted text to HTML.
Sanitize the HTML to only allow a subset of tags.
Parameters:
-
text
(str
) –The markdown-formatted text to convert.
Returns:
-
str
(str
) –The HTML-formatted text.
Source code in src/firefighter/firefighter/filters.py
readable_time_delta ¤
Format a time delta as a string. Ignore seconds and microseconds From https://github.com/wimglenn/readabledelta/blob/master/readabledelta.py (The Unlicense).
Source code in src/firefighter/firefighter/filters.py
timedelta_chop_microseconds ¤
Removes microseconds from a timedelta object.
Parameters:
-
delta
(timedelta
) –The timedelta object to remove microseconds from.
Returns:
-
timedelta
(timedelta
) –A new timedelta object with microseconds removed.
Source code in src/firefighter/firefighter/filters.py
formats ¤
See Django docs: https://docs.djangoproject.com/en/4.2/topics/i18n/formatting/ .
http_client ¤
Classes:
-
HttpClient
–Base class for HTTP clients. Uses httpx under the hood.
HttpClient ¤
Base class for HTTP clients. Uses httpx under the hood.
Sets some defaults, including: - a timeout of 15 seconds for the connection and 20 seconds for the read, to avoid hanging indefinitely - access logging
Used by firefighter.confluence.client.ConfluenceClient.
Source code in src/firefighter/firefighter/http_client.py
middleware ¤
Classes:
-
HeaderUser
–Adds the user ID to the response headers configured with "FF-User-Id", to log in access logs.
HeaderUser ¤
HeaderUser(get_response: Callable[[HttpRequest], HttpResponse])
settings ¤
This module define all the settings for the FireFighter project.
Warning
It should NOT be imported directly from any other module.
To use the settings, import them through Django's django.conf.settings object:
Modules:
-
components
– -
environments
–Overriding settings based on the environment.
-
settings_builder
– -
settings_utils
–
Classes:
-
AccessLogFilter
–Filter Gunicorn.access logs to avoid logging static files and healthcheck requests logging.
-
CustomJsonFormatter
–Custom JSON formatter for Python loggin, with Datadog specific attributes.
-
PrettyFormatter
–A custom logging formatter that formats log records with colors and a pretty output, for local development.
Attributes:
-
APP_DISPLAY_NAME
(str
) –The name of the app. Used in the title of the app, and in the navigation bar.
-
BASE_URL
(str
) –The base URL of the app. Used for links in externals surfaces, like Slack or documents.
-
CONFLUENCE_API_KEY
(str
) –The Confluence API key to use.
-
CONFLUENCE_ON_CALL_PAGE_ID
(int | None
) –The Confluence page ID where to export the current on-call schedule. If not set, export tasks will be skipped.
-
CONFLUENCE_POSTMORTEM_FOLDER_ID
(int
) –The Confluence page ID where to create and nest postmortems.
-
CONFLUENCE_POSTMORTEM_SPACE
(str
) –XXX To rename CONFLUENCE_DEFAULT_SPACE. The Confluence space where to create pages by default, mainly for postmortems.
-
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID
(int
) –The Confluence page ID of the template to use for postmortems.
-
CONFLUENCE_RUNBOOKS_FOLDER_ID
(int
) –The Confluence page ID where runbooks are stored.
-
CONFLUENCE_URL
(str
) –The Confluence URL to use. If no protocol is defined, https will be used.
-
CONFLUENCE_USERNAME
(str
) –The Confluence username to use.
-
DRF_STANDARDIZED_ERRORS
–Additional servers to add to the OpenAPI schema
-
ENABLE_CONFLUENCE
–Enable the Confluence app.
-
ENABLE_JIRA
(bool
) –Enable the Jira app.
-
ENABLE_PAGERDUTY
(bool
) –Enable PagerDuty integration.
-
ENABLE_RAID
(bool
) –Enable the Raid app. Jira app must be enabled and configured as well.
-
FF_HTTP_CLIENT_ADDITIONAL_HEADERS
(dict[str, Any] | None
) –Additional headers to send with every HTTP request made using our HttpClient. Useful for global auth, or adding a specific User-Agent.
-
FF_OVERRIDE_MENUS_CREATION
(Callable[[], None] | None
) –Override the default menus creation. Useful for custom menus.
-
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL
–Number of days between role explanation/reminders, for each role. -1 disable the messages, and 0 will send the message everytime.
-
FF_SKIP_SECRET_KEY_CHECK
(bool
) –Skip the SECRET_KEY check. Make sure to set a strong SECRET_KEY in production.
-
FF_SLACK_SKIP_CHECKS
(bool
) –Skip Slack checks. Only use for testing or demo.
-
FF_USER_ID_HEADER
(str
) –Header name to add to every HTTP request made using our HttpClient. Useful for logging.
-
PAGERDUTY_ACCOUNT_EMAIL
(str
) –PagerDuty account email, linked to the API key.
-
PAGERDUTY_API_KEY
(str
) –PagerDuty API key.
-
PAGERDUTY_URL
(str
) –PagerDuty API URL.
-
RAID_DEFAULT_JIRA_QRAFT_USER_ID
(str
) –The default Jira user ID to use for creating issues
-
RAID_JIRA_API_PASSWORD
(str
) –The Jira API password to use.
-
RAID_JIRA_API_URL
(str
) –The Jira API URL to use. If no protocol is defined, https will be used.
-
RAID_JIRA_API_USER
(str
) –The Jira API user to use.
-
RAID_JIRA_PROJECT_KEY
(str
) –The Jira project key to use for creating issues, e.g. 'INC'
-
RAID_JIRA_USER_IDS
(dict[str, str]
) –Mapping of domain to default Jira user ID
-
RAID_TOOLBOX_URL
(str
) –Toolbox URL
-
SLACK_APP_EMOJI
(str
) –Emoji to represent the app in Slack surfaces. Can be an actual emoji, or a string for a custom emoji present in your Workspace, like ":incident_logo:".
-
SLACK_BOT_TOKEN
(str
) –The Slack bot token to use.
-
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL
(str | None
) –URL to add in the Slack emergency message. Useful to point to your own documentation.
-
SLACK_EMERGENCY_USERGROUP_ID
(str | None
) –The Slack usergroup ID to use for emergency notifications. If not set, no group will be mentionned in the message.
-
SLACK_INCIDENT_COMMAND
(str
) –The Slack slash command to use to create and manage incidents.
-
SLACK_INCIDENT_COMMAND_ALIASES
(list[str]
) –Comma-separated list of aliases for the incident command.
-
SLACK_INCIDENT_HELP_GUIDE_URL
(str | None
) –URL to add in the Slack help message (/incident help). Useful to point to your own documentation.
-
SLACK_POSTMORTEM_HELP_URL
(str | None
) –URL to a guide on how to write a postmortem. Useful to point to your own documentation.
-
SLACK_SEVERITY_HELP_GUIDE_URL
(str | None
) –URL to add in the form to choose the priority. Useful to point to your own documentation.
-
SLACK_SIGNING_SECRET
(str
) –The Slack signing secret to use.
APP_DISPLAY_NAME module-attribute
¤
APP_DISPLAY_NAME: str = config('APP_DISPLAY_NAME', default='FireFighter')
The name of the app. Used in the title of the app, and in the navigation bar.
BASE_URL module-attribute
¤
BASE_URL: str = config('BASE_URL')
The base URL of the app. Used for links in externals surfaces, like Slack or documents.
CONFLUENCE_API_KEY module-attribute
¤
CONFLUENCE_API_KEY: str = config('CONFLUENCE_API_KEY')
The Confluence API key to use.
CONFLUENCE_ON_CALL_PAGE_ID module-attribute
¤
CONFLUENCE_ON_CALL_PAGE_ID: int | None = config('CONFLUENCE_ON_CALL_PAGE_ID', cast=int, default=None)
The Confluence page ID where to export the current on-call schedule. If not set, export tasks will be skipped.
CONFLUENCE_POSTMORTEM_FOLDER_ID module-attribute
¤
The Confluence page ID where to create and nest postmortems.
CONFLUENCE_POSTMORTEM_SPACE module-attribute
¤
CONFLUENCE_POSTMORTEM_SPACE: str = config('CONFLUENCE_POSTMORTEM_SPACE')
XXX To rename CONFLUENCE_DEFAULT_SPACE. The Confluence space where to create pages by default, mainly for postmortems.
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID module-attribute
¤
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID: int = config('CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID', cast=int)
The Confluence page ID of the template to use for postmortems.
CONFLUENCE_RUNBOOKS_FOLDER_ID module-attribute
¤
The Confluence page ID where runbooks are stored.
CONFLUENCE_URL module-attribute
¤
CONFLUENCE_URL: str = config('CONFLUENCE_URL')
The Confluence URL to use. If no protocol is defined, https will be used.
CONFLUENCE_USERNAME module-attribute
¤
CONFLUENCE_USERNAME: str = config('CONFLUENCE_USERNAME')
The Confluence username to use.
DRF_STANDARDIZED_ERRORS module-attribute
¤
DRF_STANDARDIZED_ERRORS = {'ALLOWED_ERROR_STATUS_CODES': ['400', '401', '403', '404', '429', '500']}
Additional servers to add to the OpenAPI schema
ENABLE_CONFLUENCE module-attribute
¤
ENABLE_CONFLUENCE = config('ENABLE_CONFLUENCE', cast=bool, default=False)
Enable the Confluence app.
ENABLE_JIRA module-attribute
¤
Enable the Jira app.
ENABLE_PAGERDUTY module-attribute
¤
Enable PagerDuty integration.
ENABLE_RAID module-attribute
¤
Enable the Raid app. Jira app must be enabled and configured as well.
FF_HTTP_CLIENT_ADDITIONAL_HEADERS module-attribute
¤
Additional headers to send with every HTTP request made using our HttpClient. Useful for global auth, or adding a specific User-Agent.
FF_OVERRIDE_MENUS_CREATION module-attribute
¤
FF_OVERRIDE_MENUS_CREATION: Callable[[], None] | None = None
Override the default menus creation. Useful for custom menus.
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL module-attribute
¤
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL = config('FF_ROLE_REMINDER_MIN_DAYS_INTERVAL', default=90, cast=int)
Number of days between role explanation/reminders, for each role. -1 disable the messages, and 0 will send the message everytime.
FF_SKIP_SECRET_KEY_CHECK module-attribute
¤
Skip the SECRET_KEY check. Make sure to set a strong SECRET_KEY in production.
FF_SLACK_SKIP_CHECKS module-attribute
¤
FF_SLACK_SKIP_CHECKS: bool = config('FF_SLACK_SKIP_CHECKS', cast=bool, default=_is_default_skip_check_cmd)
Skip Slack checks. Only use for testing or demo.
FF_USER_ID_HEADER module-attribute
¤
FF_USER_ID_HEADER: str = 'FF-User-Id'
Header name to add to every HTTP request made using our HttpClient. Useful for logging.
PAGERDUTY_ACCOUNT_EMAIL module-attribute
¤
PAGERDUTY_ACCOUNT_EMAIL: str = config('PAGERDUTY_ACCOUNT_EMAIL')
PagerDuty account email, linked to the API key.
PAGERDUTY_API_KEY module-attribute
¤
PAGERDUTY_API_KEY: str = config('PAGERDUTY_API_KEY')
PagerDuty API key.
PAGERDUTY_URL module-attribute
¤
PAGERDUTY_URL: str = config('PAGERDUTY_URL', default='https://api.pagerduty.com')
PagerDuty API URL.
RAID_DEFAULT_JIRA_QRAFT_USER_ID module-attribute
¤
RAID_DEFAULT_JIRA_QRAFT_USER_ID: str = config('RAID_DEFAULT_JIRA_QRAFT_USER_ID')
The default Jira user ID to use for creating issues
RAID_JIRA_API_PASSWORD module-attribute
¤
RAID_JIRA_API_PASSWORD: str = config('RAID_JIRA_API_PASSWORD')
The Jira API password to use.
RAID_JIRA_API_URL module-attribute
¤
RAID_JIRA_API_URL: str = config('RAID_JIRA_API_URL')
The Jira API URL to use. If no protocol is defined, https will be used.
RAID_JIRA_API_USER module-attribute
¤
RAID_JIRA_API_USER: str = config('RAID_JIRA_API_USER')
The Jira API user to use.
RAID_JIRA_PROJECT_KEY module-attribute
¤
RAID_JIRA_PROJECT_KEY: str = config('RAID_JIRA_PROJECT_KEY')
The Jira project key to use for creating issues, e.g. 'INC'
RAID_JIRA_USER_IDS module-attribute
¤
Mapping of domain to default Jira user ID
SLACK_APP_EMOJI module-attribute
¤
SLACK_APP_EMOJI: str = config('SLACK_APP_EMOJI', default=':fire_extinguisher:')
Emoji to represent the app in Slack surfaces. Can be an actual emoji, or a string for a custom emoji present in your Workspace, like ":incident_logo:".
SLACK_BOT_TOKEN module-attribute
¤
SLACK_BOT_TOKEN: str = config('SLACK_BOT_TOKEN')
The Slack bot token to use.
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL module-attribute
¤
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL: str | None = config('SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL', default=None)
URL to add in the Slack emergency message. Useful to point to your own documentation.
SLACK_EMERGENCY_USERGROUP_ID module-attribute
¤
SLACK_EMERGENCY_USERGROUP_ID: str | None = config('SLACK_EMERGENCY_USERGROUP_ID', default=None)
The Slack usergroup ID to use for emergency notifications. If not set, no group will be mentionned in the message.
SLACK_INCIDENT_COMMAND module-attribute
¤
SLACK_INCIDENT_COMMAND: str = config('SLACK_INCIDENT_COMMAND', default='/incident')
The Slack slash command to use to create and manage incidents.
SLACK_INCIDENT_COMMAND_ALIASES module-attribute
¤
SLACK_INCIDENT_COMMAND_ALIASES: list[str] = config('SLACK_INCIDENT_COMMAND_ALIASES', cast=Csv(), default='')
Comma-separated list of aliases for the incident command.
SLACK_INCIDENT_HELP_GUIDE_URL module-attribute
¤
SLACK_INCIDENT_HELP_GUIDE_URL: str | None = config('SLACK_INCIDENT_HELP_GUIDE_URL', default=None)
URL to add in the Slack help message (/incident help). Useful to point to your own documentation.
SLACK_POSTMORTEM_HELP_URL module-attribute
¤
SLACK_POSTMORTEM_HELP_URL: str | None = config('SLACK_POSTMORTEM_HELP_URL', default=None)
URL to a guide on how to write a postmortem. Useful to point to your own documentation.
SLACK_SEVERITY_HELP_GUIDE_URL module-attribute
¤
SLACK_SEVERITY_HELP_GUIDE_URL: str | None = config('SLACK_SEVERITY_HELP_GUIDE_URL', default=None)
URL to add in the form to choose the priority. Useful to point to your own documentation.
SLACK_SIGNING_SECRET module-attribute
¤
SLACK_SIGNING_SECRET: str = config('SLACK_SIGNING_SECRET')
The Slack signing secret to use.
AccessLogFilter ¤
Bases: Filter
Filter Gunicorn.access logs to avoid logging static files and healthcheck requests logging.
CustomJsonFormatter ¤
Bases: JsonFormatter
Custom JSON formatter for Python loggin, with Datadog specific attributes.
Source code in src/firefighter/logging/custom_json_formatter.py
PrettyFormatter ¤
components ¤
Modules:
-
api
– -
celery
–Celery settings definition.
-
common
–Django settings for server project.
-
confluence
– -
jira_app
– -
logging
– -
pagerduty
– -
raid
– -
slack
–
api ¤
Attributes:
-
DRF_STANDARDIZED_ERRORS
–Additional servers to add to the OpenAPI schema
DRF_STANDARDIZED_ERRORS module-attribute
¤
DRF_STANDARDIZED_ERRORS = {'ALLOWED_ERROR_STATUS_CODES': ['400', '401', '403', '404', '429', '500']}
Additional servers to add to the OpenAPI schema
celery ¤
Celery settings definition.
common ¤
Django settings for server project.
For more information on this file, see https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their config, see https://docs.djangoproject.com/en/4.2/ref/settings/
Attributes:
-
FF_DEBUG_ERROR_PAGES
(bool
) –Add routes to display error pages. Useful for debugging.
-
FF_EXPOSE_API_DOCS
(bool
) –Expose the API documentation. Useful for debugging. Can be a security issue.
-
FF_HTTP_CLIENT_ADDITIONAL_HEADERS
(dict[str, Any] | None
) –Additional headers to send with every HTTP request made using our HttpClient. Useful for global auth, or adding a specific User-Agent.
-
FF_OVERRIDE_MENUS_CREATION
(Callable[[], None] | None
) –Override the default menus creation. Useful for custom menus.
-
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL
–Number of days between role explanation/reminders, for each role. -1 disable the messages, and 0 will send the message everytime.
-
FF_SKIP_SECRET_KEY_CHECK
(bool
) –Skip the SECRET_KEY check. Make sure to set a strong SECRET_KEY in production.
-
FF_USER_ID_HEADER
(str
) –Header name to add to every HTTP request made using our HttpClient. Useful for logging.
FF_DEBUG_ERROR_PAGES module-attribute
¤
Add routes to display error pages. Useful for debugging.
FF_EXPOSE_API_DOCS module-attribute
¤
Expose the API documentation. Useful for debugging. Can be a security issue.
FF_HTTP_CLIENT_ADDITIONAL_HEADERS module-attribute
¤
Additional headers to send with every HTTP request made using our HttpClient. Useful for global auth, or adding a specific User-Agent.
FF_OVERRIDE_MENUS_CREATION module-attribute
¤
FF_OVERRIDE_MENUS_CREATION: Callable[[], None] | None = None
Override the default menus creation. Useful for custom menus.
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL module-attribute
¤
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL = config('FF_ROLE_REMINDER_MIN_DAYS_INTERVAL', default=90, cast=int)
Number of days between role explanation/reminders, for each role. -1 disable the messages, and 0 will send the message everytime.
FF_SKIP_SECRET_KEY_CHECK module-attribute
¤
Skip the SECRET_KEY check. Make sure to set a strong SECRET_KEY in production.
confluence ¤
Attributes:
-
CONFLUENCE_API_KEY
(str
) –The Confluence API key to use.
-
CONFLUENCE_ON_CALL_PAGE_ID
(int | None
) –The Confluence page ID where to export the current on-call schedule. If not set, export tasks will be skipped.
-
CONFLUENCE_POSTMORTEM_FOLDER_ID
(int
) –The Confluence page ID where to create and nest postmortems.
-
CONFLUENCE_POSTMORTEM_SPACE
(str
) –XXX To rename CONFLUENCE_DEFAULT_SPACE. The Confluence space where to create pages by default, mainly for postmortems.
-
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID
(int
) –The Confluence page ID of the template to use for postmortems.
-
CONFLUENCE_RUNBOOKS_FOLDER_ID
(int
) –The Confluence page ID where runbooks are stored.
-
CONFLUENCE_URL
(str
) –The Confluence URL to use. If no protocol is defined, https will be used.
-
CONFLUENCE_USERNAME
(str
) –The Confluence username to use.
-
ENABLE_CONFLUENCE
–Enable the Confluence app.
CONFLUENCE_API_KEY module-attribute
¤
CONFLUENCE_API_KEY: str = config('CONFLUENCE_API_KEY')
The Confluence API key to use.
CONFLUENCE_ON_CALL_PAGE_ID module-attribute
¤
CONFLUENCE_ON_CALL_PAGE_ID: int | None = config('CONFLUENCE_ON_CALL_PAGE_ID', cast=int, default=None)
The Confluence page ID where to export the current on-call schedule. If not set, export tasks will be skipped.
CONFLUENCE_POSTMORTEM_FOLDER_ID module-attribute
¤
The Confluence page ID where to create and nest postmortems.
CONFLUENCE_POSTMORTEM_SPACE module-attribute
¤
CONFLUENCE_POSTMORTEM_SPACE: str = config('CONFLUENCE_POSTMORTEM_SPACE')
XXX To rename CONFLUENCE_DEFAULT_SPACE. The Confluence space where to create pages by default, mainly for postmortems.
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID module-attribute
¤
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID: int = config('CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID', cast=int)
The Confluence page ID of the template to use for postmortems.
CONFLUENCE_RUNBOOKS_FOLDER_ID module-attribute
¤
The Confluence page ID where runbooks are stored.
CONFLUENCE_URL module-attribute
¤
CONFLUENCE_URL: str = config('CONFLUENCE_URL')
The Confluence URL to use. If no protocol is defined, https will be used.
jira_app ¤
Attributes:
-
ENABLE_JIRA
(bool
) –Enable the Jira app.
-
RAID_JIRA_API_PASSWORD
(str
) –The Jira API password to use.
-
RAID_JIRA_API_URL
(str
) –The Jira API URL to use. If no protocol is defined, https will be used.
-
RAID_JIRA_API_USER
(str
) –The Jira API user to use.
ENABLE_JIRA module-attribute
¤
Enable the Jira app.
RAID_JIRA_API_PASSWORD module-attribute
¤
RAID_JIRA_API_PASSWORD: str = config('RAID_JIRA_API_PASSWORD')
The Jira API password to use.
logging ¤
Classes:
-
AccessLogFilter
–Filter Gunicorn.access logs to avoid logging static files and healthcheck requests logging.
pagerduty ¤
Attributes:
-
ENABLE_PAGERDUTY
(bool
) –Enable PagerDuty integration.
-
PAGERDUTY_ACCOUNT_EMAIL
(str
) –PagerDuty account email, linked to the API key.
-
PAGERDUTY_API_KEY
(str
) –PagerDuty API key.
-
PAGERDUTY_URL
(str
) –PagerDuty API URL.
ENABLE_PAGERDUTY module-attribute
¤
Enable PagerDuty integration.
PAGERDUTY_ACCOUNT_EMAIL module-attribute
¤
PAGERDUTY_ACCOUNT_EMAIL: str = config('PAGERDUTY_ACCOUNT_EMAIL')
PagerDuty account email, linked to the API key.
raid ¤
Attributes:
-
ENABLE_RAID
(bool
) –Enable the Raid app. Jira app must be enabled and configured as well.
-
RAID_DEFAULT_JIRA_QRAFT_USER_ID
(str
) –The default Jira user ID to use for creating issues
-
RAID_JIRA_PROJECT_KEY
(str
) –The Jira project key to use for creating issues, e.g. 'INC'
-
RAID_JIRA_USER_IDS
(dict[str, str]
) –Mapping of domain to default Jira user ID
-
RAID_TOOLBOX_URL
(str
) –Toolbox URL
ENABLE_RAID module-attribute
¤
Enable the Raid app. Jira app must be enabled and configured as well.
RAID_DEFAULT_JIRA_QRAFT_USER_ID module-attribute
¤
RAID_DEFAULT_JIRA_QRAFT_USER_ID: str = config('RAID_DEFAULT_JIRA_QRAFT_USER_ID')
The default Jira user ID to use for creating issues
RAID_JIRA_PROJECT_KEY module-attribute
¤
RAID_JIRA_PROJECT_KEY: str = config('RAID_JIRA_PROJECT_KEY')
The Jira project key to use for creating issues, e.g. 'INC'
RAID_JIRA_USER_IDS module-attribute
¤
Mapping of domain to default Jira user ID
slack ¤
Attributes:
-
FF_SLACK_SKIP_CHECKS
(bool
) –Skip Slack checks. Only use for testing or demo.
-
SLACK_APP_EMOJI
(str
) –Emoji to represent the app in Slack surfaces. Can be an actual emoji, or a string for a custom emoji present in your Workspace, like ":incident_logo:".
-
SLACK_BOT_TOKEN
(str
) –The Slack bot token to use.
-
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL
(str | None
) –URL to add in the Slack emergency message. Useful to point to your own documentation.
-
SLACK_EMERGENCY_USERGROUP_ID
(str | None
) –The Slack usergroup ID to use for emergency notifications. If not set, no group will be mentionned in the message.
-
SLACK_INCIDENT_COMMAND
(str
) –The Slack slash command to use to create and manage incidents.
-
SLACK_INCIDENT_COMMAND_ALIASES
(list[str]
) –Comma-separated list of aliases for the incident command.
-
SLACK_INCIDENT_HELP_GUIDE_URL
(str | None
) –URL to add in the Slack help message (/incident help). Useful to point to your own documentation.
-
SLACK_POSTMORTEM_HELP_URL
(str | None
) –URL to a guide on how to write a postmortem. Useful to point to your own documentation.
-
SLACK_SEVERITY_HELP_GUIDE_URL
(str | None
) –URL to add in the form to choose the priority. Useful to point to your own documentation.
-
SLACK_SIGNING_SECRET
(str
) –The Slack signing secret to use.
FF_SLACK_SKIP_CHECKS module-attribute
¤
FF_SLACK_SKIP_CHECKS: bool = config('FF_SLACK_SKIP_CHECKS', cast=bool, default=_is_default_skip_check_cmd)
Skip Slack checks. Only use for testing or demo.
SLACK_APP_EMOJI module-attribute
¤
SLACK_APP_EMOJI: str = config('SLACK_APP_EMOJI', default=':fire_extinguisher:')
Emoji to represent the app in Slack surfaces. Can be an actual emoji, or a string for a custom emoji present in your Workspace, like ":incident_logo:".
SLACK_BOT_TOKEN module-attribute
¤
SLACK_BOT_TOKEN: str = config('SLACK_BOT_TOKEN')
The Slack bot token to use.
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL module-attribute
¤
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL: str | None = config('SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL', default=None)
URL to add in the Slack emergency message. Useful to point to your own documentation.
SLACK_EMERGENCY_USERGROUP_ID module-attribute
¤
SLACK_EMERGENCY_USERGROUP_ID: str | None = config('SLACK_EMERGENCY_USERGROUP_ID', default=None)
The Slack usergroup ID to use for emergency notifications. If not set, no group will be mentionned in the message.
SLACK_INCIDENT_COMMAND module-attribute
¤
SLACK_INCIDENT_COMMAND: str = config('SLACK_INCIDENT_COMMAND', default='/incident')
The Slack slash command to use to create and manage incidents.
SLACK_INCIDENT_COMMAND_ALIASES module-attribute
¤
SLACK_INCIDENT_COMMAND_ALIASES: list[str] = config('SLACK_INCIDENT_COMMAND_ALIASES', cast=Csv(), default='')
Comma-separated list of aliases for the incident command.
SLACK_INCIDENT_HELP_GUIDE_URL module-attribute
¤
SLACK_INCIDENT_HELP_GUIDE_URL: str | None = config('SLACK_INCIDENT_HELP_GUIDE_URL', default=None)
URL to add in the Slack help message (/incident help). Useful to point to your own documentation.
SLACK_POSTMORTEM_HELP_URL module-attribute
¤
SLACK_POSTMORTEM_HELP_URL: str | None = config('SLACK_POSTMORTEM_HELP_URL', default=None)
URL to a guide on how to write a postmortem. Useful to point to your own documentation.
environments ¤
Overriding settings based on the environment.
Modules:
settings_builder ¤
Classes:
-
AccessLogFilter
–Filter Gunicorn.access logs to avoid logging static files and healthcheck requests logging.
-
CustomJsonFormatter
–Custom JSON formatter for Python loggin, with Datadog specific attributes.
-
PrettyFormatter
–A custom logging formatter that formats log records with colors and a pretty output, for local development.
Attributes:
-
APP_DISPLAY_NAME
(str
) –The name of the app. Used in the title of the app, and in the navigation bar.
-
BASE_URL
(str
) –The base URL of the app. Used for links in externals surfaces, like Slack or documents.
-
CONFLUENCE_API_KEY
(str
) –The Confluence API key to use.
-
CONFLUENCE_ON_CALL_PAGE_ID
(int | None
) –The Confluence page ID where to export the current on-call schedule. If not set, export tasks will be skipped.
-
CONFLUENCE_POSTMORTEM_FOLDER_ID
(int
) –The Confluence page ID where to create and nest postmortems.
-
CONFLUENCE_POSTMORTEM_SPACE
(str
) –XXX To rename CONFLUENCE_DEFAULT_SPACE. The Confluence space where to create pages by default, mainly for postmortems.
-
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID
(int
) –The Confluence page ID of the template to use for postmortems.
-
CONFLUENCE_RUNBOOKS_FOLDER_ID
(int
) –The Confluence page ID where runbooks are stored.
-
CONFLUENCE_URL
(str
) –The Confluence URL to use. If no protocol is defined, https will be used.
-
CONFLUENCE_USERNAME
(str
) –The Confluence username to use.
-
DRF_STANDARDIZED_ERRORS
–Additional servers to add to the OpenAPI schema
-
ENABLE_CONFLUENCE
–Enable the Confluence app.
-
ENABLE_JIRA
(bool
) –Enable the Jira app.
-
ENABLE_PAGERDUTY
(bool
) –Enable PagerDuty integration.
-
ENABLE_RAID
(bool
) –Enable the Raid app. Jira app must be enabled and configured as well.
-
FF_HTTP_CLIENT_ADDITIONAL_HEADERS
(dict[str, Any] | None
) –Additional headers to send with every HTTP request made using our HttpClient. Useful for global auth, or adding a specific User-Agent.
-
FF_OVERRIDE_MENUS_CREATION
(Callable[[], None] | None
) –Override the default menus creation. Useful for custom menus.
-
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL
–Number of days between role explanation/reminders, for each role. -1 disable the messages, and 0 will send the message everytime.
-
FF_SKIP_SECRET_KEY_CHECK
(bool
) –Skip the SECRET_KEY check. Make sure to set a strong SECRET_KEY in production.
-
FF_SLACK_SKIP_CHECKS
(bool
) –Skip Slack checks. Only use for testing or demo.
-
FF_USER_ID_HEADER
(str
) –Header name to add to every HTTP request made using our HttpClient. Useful for logging.
-
PAGERDUTY_ACCOUNT_EMAIL
(str
) –PagerDuty account email, linked to the API key.
-
PAGERDUTY_API_KEY
(str
) –PagerDuty API key.
-
PAGERDUTY_URL
(str
) –PagerDuty API URL.
-
RAID_DEFAULT_JIRA_QRAFT_USER_ID
(str
) –The default Jira user ID to use for creating issues
-
RAID_JIRA_API_PASSWORD
(str
) –The Jira API password to use.
-
RAID_JIRA_API_URL
(str
) –The Jira API URL to use. If no protocol is defined, https will be used.
-
RAID_JIRA_API_USER
(str
) –The Jira API user to use.
-
RAID_JIRA_PROJECT_KEY
(str
) –The Jira project key to use for creating issues, e.g. 'INC'
-
RAID_JIRA_USER_IDS
(dict[str, str]
) –Mapping of domain to default Jira user ID
-
RAID_TOOLBOX_URL
(str
) –Toolbox URL
-
SLACK_APP_EMOJI
(str
) –Emoji to represent the app in Slack surfaces. Can be an actual emoji, or a string for a custom emoji present in your Workspace, like ":incident_logo:".
-
SLACK_BOT_TOKEN
(str
) –The Slack bot token to use.
-
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL
(str | None
) –URL to add in the Slack emergency message. Useful to point to your own documentation.
-
SLACK_EMERGENCY_USERGROUP_ID
(str | None
) –The Slack usergroup ID to use for emergency notifications. If not set, no group will be mentionned in the message.
-
SLACK_INCIDENT_COMMAND
(str
) –The Slack slash command to use to create and manage incidents.
-
SLACK_INCIDENT_COMMAND_ALIASES
(list[str]
) –Comma-separated list of aliases for the incident command.
-
SLACK_INCIDENT_HELP_GUIDE_URL
(str | None
) –URL to add in the Slack help message (/incident help). Useful to point to your own documentation.
-
SLACK_POSTMORTEM_HELP_URL
(str | None
) –URL to a guide on how to write a postmortem. Useful to point to your own documentation.
-
SLACK_SEVERITY_HELP_GUIDE_URL
(str | None
) –URL to add in the form to choose the priority. Useful to point to your own documentation.
-
SLACK_SIGNING_SECRET
(str
) –The Slack signing secret to use.
APP_DISPLAY_NAME module-attribute
¤
APP_DISPLAY_NAME: str = config('APP_DISPLAY_NAME', default='FireFighter')
The name of the app. Used in the title of the app, and in the navigation bar.
BASE_URL module-attribute
¤
BASE_URL: str = config('BASE_URL')
The base URL of the app. Used for links in externals surfaces, like Slack or documents.
CONFLUENCE_API_KEY module-attribute
¤
CONFLUENCE_API_KEY: str = config('CONFLUENCE_API_KEY')
The Confluence API key to use.
CONFLUENCE_ON_CALL_PAGE_ID module-attribute
¤
CONFLUENCE_ON_CALL_PAGE_ID: int | None = config('CONFLUENCE_ON_CALL_PAGE_ID', cast=int, default=None)
The Confluence page ID where to export the current on-call schedule. If not set, export tasks will be skipped.
CONFLUENCE_POSTMORTEM_FOLDER_ID module-attribute
¤
The Confluence page ID where to create and nest postmortems.
CONFLUENCE_POSTMORTEM_SPACE module-attribute
¤
CONFLUENCE_POSTMORTEM_SPACE: str = config('CONFLUENCE_POSTMORTEM_SPACE')
XXX To rename CONFLUENCE_DEFAULT_SPACE. The Confluence space where to create pages by default, mainly for postmortems.
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID module-attribute
¤
CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID: int = config('CONFLUENCE_POSTMORTEM_TEMPLATE_PAGE_ID', cast=int)
The Confluence page ID of the template to use for postmortems.
CONFLUENCE_RUNBOOKS_FOLDER_ID module-attribute
¤
The Confluence page ID where runbooks are stored.
CONFLUENCE_URL module-attribute
¤
CONFLUENCE_URL: str = config('CONFLUENCE_URL')
The Confluence URL to use. If no protocol is defined, https will be used.
CONFLUENCE_USERNAME module-attribute
¤
CONFLUENCE_USERNAME: str = config('CONFLUENCE_USERNAME')
The Confluence username to use.
DRF_STANDARDIZED_ERRORS module-attribute
¤
DRF_STANDARDIZED_ERRORS = {'ALLOWED_ERROR_STATUS_CODES': ['400', '401', '403', '404', '429', '500']}
Additional servers to add to the OpenAPI schema
ENABLE_CONFLUENCE module-attribute
¤
ENABLE_CONFLUENCE = config('ENABLE_CONFLUENCE', cast=bool, default=False)
Enable the Confluence app.
ENABLE_JIRA module-attribute
¤
Enable the Jira app.
ENABLE_PAGERDUTY module-attribute
¤
Enable PagerDuty integration.
ENABLE_RAID module-attribute
¤
Enable the Raid app. Jira app must be enabled and configured as well.
FF_HTTP_CLIENT_ADDITIONAL_HEADERS module-attribute
¤
Additional headers to send with every HTTP request made using our HttpClient. Useful for global auth, or adding a specific User-Agent.
FF_OVERRIDE_MENUS_CREATION module-attribute
¤
FF_OVERRIDE_MENUS_CREATION: Callable[[], None] | None = None
Override the default menus creation. Useful for custom menus.
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL module-attribute
¤
FF_ROLE_REMINDER_MIN_DAYS_INTERVAL = config('FF_ROLE_REMINDER_MIN_DAYS_INTERVAL', default=90, cast=int)
Number of days between role explanation/reminders, for each role. -1 disable the messages, and 0 will send the message everytime.
FF_SKIP_SECRET_KEY_CHECK module-attribute
¤
Skip the SECRET_KEY check. Make sure to set a strong SECRET_KEY in production.
FF_SLACK_SKIP_CHECKS module-attribute
¤
FF_SLACK_SKIP_CHECKS: bool = config('FF_SLACK_SKIP_CHECKS', cast=bool, default=_is_default_skip_check_cmd)
Skip Slack checks. Only use for testing or demo.
FF_USER_ID_HEADER module-attribute
¤
FF_USER_ID_HEADER: str = 'FF-User-Id'
Header name to add to every HTTP request made using our HttpClient. Useful for logging.
PAGERDUTY_ACCOUNT_EMAIL module-attribute
¤
PAGERDUTY_ACCOUNT_EMAIL: str = config('PAGERDUTY_ACCOUNT_EMAIL')
PagerDuty account email, linked to the API key.
PAGERDUTY_API_KEY module-attribute
¤
PAGERDUTY_API_KEY: str = config('PAGERDUTY_API_KEY')
PagerDuty API key.
PAGERDUTY_URL module-attribute
¤
PAGERDUTY_URL: str = config('PAGERDUTY_URL', default='https://api.pagerduty.com')
PagerDuty API URL.
RAID_DEFAULT_JIRA_QRAFT_USER_ID module-attribute
¤
RAID_DEFAULT_JIRA_QRAFT_USER_ID: str = config('RAID_DEFAULT_JIRA_QRAFT_USER_ID')
The default Jira user ID to use for creating issues
RAID_JIRA_API_PASSWORD module-attribute
¤
RAID_JIRA_API_PASSWORD: str = config('RAID_JIRA_API_PASSWORD')
The Jira API password to use.
RAID_JIRA_API_URL module-attribute
¤
RAID_JIRA_API_URL: str = config('RAID_JIRA_API_URL')
The Jira API URL to use. If no protocol is defined, https will be used.
RAID_JIRA_API_USER module-attribute
¤
RAID_JIRA_API_USER: str = config('RAID_JIRA_API_USER')
The Jira API user to use.
RAID_JIRA_PROJECT_KEY module-attribute
¤
RAID_JIRA_PROJECT_KEY: str = config('RAID_JIRA_PROJECT_KEY')
The Jira project key to use for creating issues, e.g. 'INC'
RAID_JIRA_USER_IDS module-attribute
¤
Mapping of domain to default Jira user ID
SLACK_APP_EMOJI module-attribute
¤
SLACK_APP_EMOJI: str = config('SLACK_APP_EMOJI', default=':fire_extinguisher:')
Emoji to represent the app in Slack surfaces. Can be an actual emoji, or a string for a custom emoji present in your Workspace, like ":incident_logo:".
SLACK_BOT_TOKEN module-attribute
¤
SLACK_BOT_TOKEN: str = config('SLACK_BOT_TOKEN')
The Slack bot token to use.
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL module-attribute
¤
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL: str | None = config('SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL', default=None)
URL to add in the Slack emergency message. Useful to point to your own documentation.
SLACK_EMERGENCY_USERGROUP_ID module-attribute
¤
SLACK_EMERGENCY_USERGROUP_ID: str | None = config('SLACK_EMERGENCY_USERGROUP_ID', default=None)
The Slack usergroup ID to use for emergency notifications. If not set, no group will be mentionned in the message.
SLACK_INCIDENT_COMMAND module-attribute
¤
SLACK_INCIDENT_COMMAND: str = config('SLACK_INCIDENT_COMMAND', default='/incident')
The Slack slash command to use to create and manage incidents.
SLACK_INCIDENT_COMMAND_ALIASES module-attribute
¤
SLACK_INCIDENT_COMMAND_ALIASES: list[str] = config('SLACK_INCIDENT_COMMAND_ALIASES', cast=Csv(), default='')
Comma-separated list of aliases for the incident command.
SLACK_INCIDENT_HELP_GUIDE_URL module-attribute
¤
SLACK_INCIDENT_HELP_GUIDE_URL: str | None = config('SLACK_INCIDENT_HELP_GUIDE_URL', default=None)
URL to add in the Slack help message (/incident help). Useful to point to your own documentation.
SLACK_POSTMORTEM_HELP_URL module-attribute
¤
SLACK_POSTMORTEM_HELP_URL: str | None = config('SLACK_POSTMORTEM_HELP_URL', default=None)
URL to a guide on how to write a postmortem. Useful to point to your own documentation.
SLACK_SEVERITY_HELP_GUIDE_URL module-attribute
¤
SLACK_SEVERITY_HELP_GUIDE_URL: str | None = config('SLACK_SEVERITY_HELP_GUIDE_URL', default=None)
URL to add in the form to choose the priority. Useful to point to your own documentation.
SLACK_SIGNING_SECRET module-attribute
¤
SLACK_SIGNING_SECRET: str = config('SLACK_SIGNING_SECRET')
The Slack signing secret to use.
AccessLogFilter ¤
Bases: Filter
Filter Gunicorn.access logs to avoid logging static files and healthcheck requests logging.
CustomJsonFormatter ¤
Bases: JsonFormatter
Custom JSON formatter for Python loggin, with Datadog specific attributes.
Source code in src/firefighter/logging/custom_json_formatter.py
PrettyFormatter ¤
settings_utils ¤
Attributes:
-
APP_DISPLAY_NAME
(str
) –The name of the app. Used in the title of the app, and in the navigation bar.
-
BASE_URL
(str
) –The base URL of the app. Used for links in externals surfaces, like Slack or documents.
urls ¤
firefighter URL Configuration.
The urlpatterns
list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:¤
Function views¤
- Add an import:
from my_app import views
- Add a URL to urlpatterns:
path('', views.home, name='home')
Class-based views¤
- Add an import:
from other_app.views import Home
- Add a URL to urlpatterns:
path('', Home.as_view(), name='home')
Including another URLconf¤
- Import the include() function:
from django.urls import include, path
- Add a URL to urlpatterns:
path('blog/', include('blog.urls'))
utils ¤
Functions:
-
get_first_in
–Returns the first element of a list of dicts, where the value of a key matches one in the provided iterable.
-
get_in
–Get a value from arbitrarily nested dicts.
-
is_during_office_hours
–Check whether a datetime is during office hours. 9am-5pm, Mon-Fri.
get_first_in ¤
get_first_in(ulist: list[T], key: str | Sequence[str], matches: Iterable[str], default: V | None = None) -> T | V | None
Returns the first element of a list of dicts, where the value of a key matches one in the provided iterable.
Source code in src/firefighter/firefighter/utils.py
get_in ¤
get_in(dictionary: dict[str, Any] | Any | None, keys: str | Sequence[str], default: Any | None = None) -> Any
Get a value from arbitrarily nested dicts.
Source code in src/firefighter/firefighter/utils.py
views ¤
Classes:
-
CustomDetailView
–A custom detail view that adds the admin edit URL to the context, as
admin_edit_url
.
Functions:
-
get_admin_edit_url
–Construct the URL name for the admin edit page using the model's app_label and model_name.
CustomDetailView ¤
Bases: DetailView[_MT]
, Generic[_MT]
A custom detail view that adds the admin edit URL to the context, as admin_edit_url
.
get_admin_edit_url cached
¤
Construct the URL name for the admin edit page using the model's app_label and model_name.
Source code in src/firefighter/firefighter/views.py
wsgi ¤
WSGI config for firefighter project.
It exposes the WSGI callable as a module-level variable named application
.
For more information on this file, see https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/