File tree Expand file tree Collapse file tree 9 files changed +114
-2
lines changed
frontend/src/features/api/gen/models Expand file tree Collapse file tree 9 files changed +114
-2
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,16 @@ The application uses a new environment file structure with `.defaults` and `.loc
268
268
| ` AI_MODEL ` | None | Default model used for AI features | Optional |
269
269
| ` AI_FEATURE_SUMMARY_ENABLED ` | ` False ` | Default enabled mode for summary AI features | Required |
270
270
271
+ ### External Services
272
+
273
+ #### Drive
274
+
275
+ | Variable | Default | Description | Required |
276
+ | ----------| ---------| -------------| ----------|
277
+ | ` DRIVE_BASE_URL ` | None | Base URL to access Drive endpoints | Optional |
278
+
279
+
280
+
271
281
## Legend
272
282
273
283
- ** Required** : Must be set for the application to function
Original file line number Diff line number Diff line change @@ -73,9 +73,13 @@ MTA_OUT_SMTP_PASSWORD=pass
73
73
MDA_API_SECRET=my-shared-secret-mda
74
74
SALT_KEY=ThisIsAnExampleSaltForDevPurposeOnly
75
75
76
- # AI
76
+ # AI
77
77
AI_BASE_URL=
78
78
AI_API_KEY=
79
79
AI_MODEL=
80
80
81
- AI_FEATURE_SUMMARY_ENABLED=False
81
+ AI_FEATURE_SUMMARY_ENABLED=False
82
+
83
+ # Interoperability
84
+ # Drive - https://github.com/suitenumerique/drive
85
+ DRIVE_BASE_URL=
Original file line number Diff line number Diff line change 181
181
"AI_FEATURE_SUMMARY_ENABLED" : {
182
182
"type" : " boolean" ,
183
183
"readOnly" : true
184
+ },
185
+ "DRIVE" : {
186
+ "type" : " object" ,
187
+ "description" : " The URLs of the Drive external service." ,
188
+ "properties" : {
189
+ "sdk_url" : {
190
+ "type" : " string" ,
191
+ "readOnly" : true
192
+ },
193
+ "api_url" : {
194
+ "type" : " string" ,
195
+ "readOnly" : true
196
+ }
197
+ },
198
+ "readOnly" : true ,
199
+ "required" : [
200
+ " sdk_url" ,
201
+ " api_url"
202
+ ]
184
203
}
185
204
},
186
205
"required" : [
Original file line number Diff line number Diff line change @@ -49,6 +49,22 @@ class ConfigView(drf.views.APIView):
49
49
"type" : "boolean" ,
50
50
"readOnly" : True ,
51
51
},
52
+ "DRIVE" : {
53
+ "type" : "object" ,
54
+ "description" : "The URLs of the Drive external service." ,
55
+ "properties" : {
56
+ "sdk_url" : {
57
+ "type" : "string" ,
58
+ "readOnly" : True ,
59
+ },
60
+ "api_url" : {
61
+ "type" : "string" ,
62
+ "readOnly" : True ,
63
+ },
64
+ },
65
+ "readOnly" : True ,
66
+ "required" : ["sdk_url" , "api_url" ],
67
+ },
52
68
},
53
69
"required" : [
54
70
"ENVIRONMENT" ,
@@ -83,7 +99,19 @@ def get(self, request):
83
99
if hasattr (settings , setting ):
84
100
dict_settings [setting ] = getattr (settings , setting )
85
101
102
+ # AI Features
86
103
dict_settings ["AI_ENABLED" ] = is_ai_enabled ()
87
104
dict_settings ["AI_FEATURE_SUMMARY_ENABLED" ] = is_ai_summary_enabled ()
88
105
106
+ # Drive service
107
+ if base_url := settings .DRIVE_CONFIG .get ("base_url" ):
108
+ dict_settings .update (
109
+ {
110
+ "DRIVE" : {
111
+ "sdk_url" : f"{ base_url } { settings .DRIVE_CONFIG .get ('sdk_url' )} " ,
112
+ "api_url" : f"{ base_url } { settings .DRIVE_CONFIG .get ('api_url' )} " ,
113
+ }
114
+ }
115
+ )
116
+
89
117
return drf .response .Response (dict_settings )
Original file line number Diff line number Diff line change 25
25
AI_BASE_URL = None ,
26
26
AI_MODEL = None ,
27
27
AI_FEATURE_SUMMARY_ENABLED = False ,
28
+ DRIVE_CONFIG = {"base_url" : None },
28
29
)
29
30
@pytest .mark .parametrize ("is_authenticated" , [False , True ])
30
31
def test_api_config (is_authenticated ):
@@ -47,3 +48,22 @@ def test_api_config(is_authenticated):
47
48
"AI_ENABLED" : False ,
48
49
"AI_FEATURE_SUMMARY_ENABLED" : False ,
49
50
}
51
+
52
+
53
+ @override_settings (
54
+ DRIVE_CONFIG = {
55
+ "base_url" : "http://localhost:8902" ,
56
+ "sdk_url" : "/sdk" ,
57
+ "api_url" : "/api/v1.0" ,
58
+ }
59
+ )
60
+ def test_api_config_with_external_services ():
61
+ """If Drive external service is configured, it should be included in the configuration."""
62
+ client = APIClient ()
63
+
64
+ response = client .get ("/api/v1.0/config/" )
65
+ assert response .status_code == HTTP_200_OK
66
+ assert response .json ().get ("DRIVE" ) == {
67
+ "sdk_url" : "http://localhost:8902/sdk" ,
68
+ "api_url" : "http://localhost:8902/api/v1.0" ,
69
+ }
Original file line number Diff line number Diff line change @@ -592,6 +592,18 @@ class Base(Configuration):
592
592
environ_prefix = None ,
593
593
)
594
594
595
+ # External services
596
+ # Settings related to the interoperability with external services
597
+ # that messges is able to use
598
+ # 1. Drive - https://github.com/suitenumerique/drive
599
+ DRIVE_CONFIG = {
600
+ "base_url" : values .Value (
601
+ default = None , environ_name = "DRIVE_BASE_URL" , environ_prefix = None
602
+ ),
603
+ "sdk_url" : "/sdk" ,
604
+ "api_url" : "/api/v1.0" ,
605
+ }
606
+
595
607
# pylint: disable=invalid-name
596
608
def __init__ (self , * args , ** kwargs ):
597
609
super ().__init__ (* args , ** kwargs )
Original file line number Diff line number Diff line change 5
5
* This is the messages API schema.
6
6
* OpenAPI spec version: 1.0.0 (v1.0)
7
7
*/
8
+ import type { ConfigRetrieve200DRIVE } from "./config_retrieve200_driv_e" ;
8
9
9
10
export type ConfigRetrieve200 = {
10
11
readonly ENVIRONMENT : string ;
@@ -18,4 +19,6 @@ export type ConfigRetrieve200 = {
18
19
readonly LANGUAGE_CODE : string ;
19
20
readonly AI_ENABLED : boolean ;
20
21
readonly AI_FEATURE_SUMMARY_ENABLED : boolean ;
22
+ /** The URLs of the Drive external service. */
23
+ readonly DRIVE ?: ConfigRetrieve200DRIVE ;
21
24
} ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Generated by orval v7.10.0 🍺
3
+ * Do not edit manually.
4
+ * messages API
5
+ * This is the messages API schema.
6
+ * OpenAPI spec version: 1.0.0 (v1.0)
7
+ */
8
+
9
+ /**
10
+ * The URLs of the Drive external service.
11
+ */
12
+ export type ConfigRetrieve200DRIVE = {
13
+ readonly sdk_url : string ;
14
+ readonly api_url : string ;
15
+ } ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export * from "./blob_upload_create201";
11
11
export * from "./blob_upload_create_body" ;
12
12
export * from "./change_flag_request_request" ;
13
13
export * from "./config_retrieve200" ;
14
+ export * from "./config_retrieve200_driv_e" ;
14
15
export * from "./contact" ;
15
16
export * from "./contacts_list_params" ;
16
17
export * from "./dnscheck_response" ;
You can’t perform that action at this time.
0 commit comments