File: settings.rst

package info (click to toggle)
python-django-guid 3.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 664 kB
  • sloc: python: 1,267; makefile: 16
file content (94 lines) | stat: -rw-r--r-- 2,586 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Settings
========

Package settings are added in your ``settings.py``:

Default settings are shown below:

.. code-block:: python

    DJANGO_GUID = {
        'GUID_HEADER_NAME': 'Correlation-ID',
        'VALIDATE_GUID': True,
        'RETURN_HEADER': True,
        'EXPOSE_HEADER': True,
        'INTEGRATIONS': [],
        'UUID_LENGTH': 32,
        'UUID_FORMAT': 'hex',
    }



.. _guid_header_name_setting:

GUID_HEADER_NAME
----------------
* **Default**: ``Correlation-ID``
* **Type**: ``string``

The name of the GUID to look for in a header in an incoming request. Remember that it's case insensitive.

.. _validate_guid_setting:

VALIDATE_GUID
-------------
* **Default**: ``True``
* **Type**: ``boolean``


Whether the :code:`GUID_HEADER_NAME` should be validated or not. If set to :code:`True`
incoming headers which are not a valid GUID (:code:`uuid.uuid4`), will be replaced with
a new one.


RETURN_HEADER
-------------
* **Default**: ``True``
* **Type**: ``boolean``

Whether to return the GUID (Correlation-ID) as a header in the response or not.
It will have the same name as the :code:`GUID_HEADER_NAME` setting.


EXPOSE_HEADER
-------------
* **Default**: ``True``
* **Type**: ``boolean``

Whether to return :code:`Access-Control-Expose-Headers` for the GUID header if
:code:`RETURN_HEADER` is :code:`True`, has no effect if :code:`RETURN_HEADER` is :code:`False`.
This is allows the JavaScript Fetch API to access the header when CORS is enabled.

INTEGRATIONS
------------
* **Default**: ``[]``
* **Type**: ``list``

Whether to enable any custom or available integrations with :code:`django_guid`.
As an example, using :code:`SentryIntegration()` as an integration would set Sentry's :code:`transaction_id` to
match the GUID used by the middleware.

IGNORE_URLS
-----------
* **Default**: ``[]``
* **Type**: ``list``

URL endpoints where the middleware will be disabled. You can put your health check endpoints here.

UUID_LENGTH
-----------
* **Default**: ``32``
* **Type**: ``int``

If a full UUID hex is too long for you, this settings lets you specify the length you wish to use.
The chance of collision in a UUID is so low, that most systems will get away with a lot
fewer than 32 characters.

UUID_FORMAT
-----------
* **Default**: ``hex``
* **Type**: ``string``

If a UUID hex is not suitable for you, this settings lets you specify the format you wish to use. The options are:
* ``hex``: The default, a 32 character hexadecimal string. e.g. ee586b0fba3c44849d20e1548210c050
* ``string``: A 36 character string. e.g. ee586b0f-ba3c-4484-9d20-e1548210c050