Skip to content

Commit 9cc853d

Browse files
committed
📝 [#324] Update documentation for setup-configuration
and use the directive provided by the library
1 parent 630972b commit 9cc853d

File tree

4 files changed

+18
-82
lines changed

4 files changed

+18
-82
lines changed

docs/conf.py

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import sys
1010

1111
import django
12+
from django.utils.translation import activate
1213

1314
sys.path.insert(0, os.path.abspath("../src"))
1415
os.environ["LOG_REQUESTS"] = "false"
@@ -39,6 +40,9 @@
3940
"sphinx.ext.autodoc",
4041
"sphinx.ext.todo",
4142
"sphinx.ext.intersphinx",
43+
"sphinx.ext.autodoc",
44+
"django_setup_configuration.documentation.setup_config_example",
45+
"django_setup_configuration.documentation.setup_config_usage",
4246
# "sphinx_tabs.tabs",
4347
# "recommonmark",
4448
# "sphinx_markdown_tables",
@@ -54,6 +58,10 @@
5458
# Usually you set "language" from the command line for these cases.
5559
language = "en"
5660

61+
# Also set the language to English for Django, to make sure that any translatable text
62+
# is also shown in English (for instance the help texts for setup configuration examples)
63+
activate("en")
64+
5765
# List of patterns, relative to source directory, that match files and
5866
# directories to ignore when looking for source files.
5967
# This pattern also affects html_static_path and html_extra_path.

docs/installation/setup_configuration.rst

+1-81
Original file line numberDiff line numberDiff line change
@@ -4,84 +4,4 @@
44
Open Klant configuration (CLI)
55
==============================
66

7-
After deploying Open Klant, it needs to be configured to be fully functional.
8-
The django management command ``setup_configuration`` assist with this configuration.
9-
You can get the full command documentation with:
10-
11-
.. code-block:: bash
12-
13-
python ./src/manage.py setup_configuration --help
14-
15-
.. warning:: This command is declarative - if configuration is manually changed after
16-
running the command and you then run the exact same command again, the manual
17-
changes will be reverted.
18-
19-
Preparation
20-
===========
21-
22-
The command executes the list of pluggable configuration steps, and each step
23-
requires specific configuration information, that should be prepared.
24-
Here is the description of all available configuration steps and the configuration
25-
format, used by each step.
26-
27-
Token configuration
28-
----------------------
29-
30-
Create a (single) YAML configuration file with your settings:
31-
32-
.. code-block:: yaml
33-
34-
tokenauth_config_enable: true
35-
tokenauth:
36-
items:
37-
- identifier: token-1
38-
token: ba9d233e95e04c4a8a661a27daffe7c9bd019067
39-
contact_person: Person 1
40-
email: person-1@example.com
41-
organization: Organization XYZ # optional
42-
application: Application XYZ # optional
43-
administration: Administration XYZ # optional
44-
45-
- identifier: token-2
46-
token: 7b2b212d9f16d171a70a1d927cdcfbd5ca7a4799
47-
contact_person: Person 2
48-
email: person-2@example.com
49-
50-
51-
Mozilla-django-oidc-db
52-
----------------------
53-
54-
Create or update the (single) YAML configuration file with your settings:
55-
56-
.. code-block:: yaml
57-
58-
...
59-
oidc_db_config_enable: true
60-
oidc_db_config_admin_auth:
61-
items:
62-
- identifier: admin-oidc
63-
oidc_rp_client_id: client-id
64-
oidc_rp_client_secret: secret
65-
endpoint_config:
66-
oidc_op_discovery_endpoint: https://keycloak.local/protocol/openid-connect/
67-
...
68-
69-
More details about configuring mozilla-django-oidc-db through ``setup_configuration``
70-
can be found at the _`documentation`: https://mozilla-django-oidc-db.readthedocs.io/en/latest/setup_configuration.html.
71-
72-
Execution
73-
=========
74-
75-
Open Klant configuration
76-
------------------------
77-
78-
With the full command invocation, everything is configured at once. Each configuration step
79-
is idempotent, so any manual changes made via the admin interface will be updated if the command
80-
is run afterwards.
81-
82-
.. code-block:: bash
83-
84-
python ./src/manage.py setup_configuration --yaml-file /path/to/config.yaml
85-
86-
.. note:: Due to a cache-bug in the underlying framework, you need to restart all
87-
replicas for part of this change to take effect everywhere.
7+
.. setup-config-usage::

src/openklant/setup_configuration/models.py

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ class Meta:
1616
"administration",
1717
)
1818
}
19+
extra_kwargs = {
20+
"identifier": {"examples": ["open-inwoner"]},
21+
"token": {"examples": ["modify-this"]},
22+
"contact_person": {"examples": ["John Doe"]},
23+
"email": {"examples": ["person@municipality.nl"]},
24+
"organization": {"examples": ["Municipality name"]},
25+
"application": {"examples": ["Open Inwoner"]},
26+
}
1927

2028

2129
class TokenAuthGroupConfigurationModel(ConfigurationModel):

src/openklant/setup_configuration/steps.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TokenAuthConfigurationStep(
1616
BaseConfigurationStep[TokenAuthGroupConfigurationModel]
1717
):
1818
"""
19-
Configure configuration groups for the Objects API backend
19+
Configure tokens for other applications to access the APIs provided by Open Klant
2020
"""
2121

2222
namespace = "tokenauth"

0 commit comments

Comments
 (0)