File tree 5 files changed +104
-0
lines changed
backend/src/openarchiefbeheer
config/setup_configuration
5 files changed +104
-0
lines changed Original file line number Diff line number Diff line change 646
646
"OIDC_RENEW_ID_TOKEN_EXPIRY_SECONDS" , default = 60 * 15
647
647
)
648
648
649
+ #
649
650
# Django privates
650
651
#
651
652
PRIVATE_MEDIA_ROOT = os .path .join (BASE_DIR , "private_media" )
652
653
653
654
PRIVATE_MEDIA_URL = "/private-media/"
655
+
656
+ #
657
+ # Django setup configuration
658
+ #
659
+ SETUP_CONFIGURATION_STEPS = [
660
+ "zgw_consumers.contrib.setup_configuration.steps.ServiceConfigurationStep" ,
661
+ "openarchiefbeheer.config.setup_configuration.steps.APIConfigConfigurationStep" ,
662
+ ]
Original file line number Diff line number Diff line change
1
+ from django_setup_configuration import ConfigurationModel
2
+ from django_setup_configuration .fields import DjangoModelRef
3
+
4
+ from ..models import APIConfig
5
+
6
+
7
+ class APIConfigConfigurationModel (ConfigurationModel ):
8
+ selectielijst_service_identifier : str = DjangoModelRef (
9
+ APIConfig , "selectielijst_api_service"
10
+ )
Original file line number Diff line number Diff line change
1
+ from django_setup_configuration import BaseConfigurationStep
2
+ from zgw_consumers .models import Service
3
+
4
+ from ..models import APIConfig
5
+ from .models import APIConfigConfigurationModel
6
+
7
+
8
+ def get_service (slug : str ) -> Service :
9
+ """
10
+ Try to find a Service and re-raise DoesNotExist with the identifier to make debugging
11
+ easier
12
+ """
13
+ try :
14
+ return Service .objects .get (slug = slug )
15
+ except Service .DoesNotExist as e :
16
+ raise Service .DoesNotExist (f"{ str (e )} (identifier = { slug } )" )
17
+
18
+
19
+ class APIConfigConfigurationStep (BaseConfigurationStep [APIConfigConfigurationModel ]):
20
+ """Configure API settings"""
21
+
22
+ config_model = APIConfigConfigurationModel
23
+ enable_setting = "api_configuration_enabled"
24
+ namespace = "api_configuration"
25
+ verbose_name = "API Configuration"
26
+
27
+ def execute (self , model : APIConfigConfigurationModel ) -> None :
28
+ service = get_service (model .selectielijst_service_identifier )
29
+
30
+ config = APIConfig .get_solo ()
31
+
32
+ # Idempotent configuration
33
+ if (
34
+ config .selectielijst_api_service
35
+ and service .pk == config .selectielijst_api_service .pk
36
+ ):
37
+ return
38
+
39
+ config .selectielijst_api_service = service
40
+ config .save ()
Original file line number Diff line number Diff line change
1
+ zgw_consumers_config_enable : True
2
+ zgw_consumers :
3
+ services :
4
+ - identifier : zaken-test
5
+ label : Open Zaak - Zaken API
6
+ oas : http://localhost:8003/zaken/api/v1/schema/openapi.yaml
7
+ api_root : http://localhost:8003/zaken/api/v1/
8
+ api_type : zrc
9
+ auth_type : zgw
10
+ client_id : test-vcr
11
+ secret : test-vcr
12
+ - identifier : documenten-test
13
+ label : Open Zaak - Documenten API
14
+ oas : http://localhost:8003/documenten/api/v1/schema/openapi.yaml
15
+ api_root : http://localhost:8003/documenten/api/v1/
16
+ api_type : drc
17
+ auth_type : zgw
18
+ client_id : test-vcr
19
+ secret : test-vcr
20
+ - identifier : catalogi-test
21
+ label : Open Zaak - Catalogi API
22
+ oas : http://localhost:8003/catalogi/api/v1/schema/openapi.yaml
23
+ api_root : http://localhost:8003/catalogi/api/v1/
24
+ api_type : ztc
25
+ auth_type : zgw
26
+ client_id : test-vcr
27
+ secret : test-vcr
28
+ - identifier : besluiten-test
29
+ label : Open Zaak - Besluiten API
30
+ oas : http://localhost:8003/besluiten/api/v1/schema/openapi.yaml
31
+ api_root : http://localhost:8003/besluiten/api/v1/
32
+ api_type : brc
33
+ auth_type : zgw
34
+ client_id : test-vcr
35
+ secret : test-vcr
36
+ - identifier : selectielijst
37
+ label : Open Zaak (public) - Selectielijst API
38
+ oas : https://selectielijst.openzaak.nl/api/v1/schema/openapi.yaml
39
+ api_root : https://selectielijst.openzaak.nl/api/v1/
40
+ api_type : orc
41
+ auth_type : no_auth
42
+
43
+ api_configuration_enabled : True
44
+ api_configuration :
45
+ selectielijst_service_identifier : selectielijst
You can’t perform that action at this time.
0 commit comments