Skip to content

Commit ea283f7

Browse files
authored
Merge pull request #244 from oxyno-zeta/develop
2 parents 7328689 + 5356f28 commit ea283f7

24 files changed

+1611
-1373
lines changed

conf/config-example.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,30 +74,45 @@ log:
7474
# path: templates/target-list.tpl
7575
# headers:
7676
# Content-Type: '{{ template "main.headers.contentType" . }}'
77+
# status: "200"
7778
# folderList:
7879
# path: templates/folder-list.tpl
7980
# headers:
8081
# Content-Type: '{{ template "main.headers.contentType" . }}'
82+
# status: "200"
8183
# badRequestError:
8284
# path: templates/bad-request-error.tpl
8385
# headers:
8486
# Content-Type: '{{ template "main.headers.contentType" . }}'
87+
# status: "400"
8588
# forbiddenError:
8689
# path: templates/forbidden-error.tpl
8790
# headers:
8891
# Content-Type: '{{ template "main.headers.contentType" . }}'
92+
# status: "403"
8993
# internalServerError:
9094
# path: templates/internal-server-error.tpl
9195
# headers:
9296
# Content-Type: '{{ template "main.headers.contentType" . }}'
97+
# status: "500"
9398
# notFoundError:
9499
# path: templates/not-found-error.tpl
95100
# headers:
96101
# Content-Type: '{{ template "main.headers.contentType" . }}'
102+
# status: "404"
97103
# unauthorizedError:
98104
# path: templates/unauthorized-error.tpl
99105
# headers:
100106
# Content-Type: '{{ template "main.headers.contentType" . }}'
107+
# status: "401"
108+
# put:
109+
# path: templates/put.tpl
110+
# headers: {}
111+
# status: "204"
112+
# delete:
113+
# path: templates/delete.tpl
114+
# headers: {}
115+
# status: "204"
101116

102117
# Authentication Providers
103118
# authProviders:
@@ -274,31 +289,49 @@ targets:
274289
# inBucket: false
275290
# path: ""
276291
# headers: {}
292+
# status: "200"
277293
# # Not found error template
278294
# notFoundError:
279295
# inBucket: false
280296
# path: ""
281297
# headers: {}
298+
# status: "404"
282299
# # Internal server error template
283300
# internalServerError:
284301
# inBucket: false
285302
# path: ""
286303
# headers: {}
304+
# status: "500"
287305
# # Forbidden error template
288306
# forbiddenError:
289307
# inBucket: false
290308
# path: ""
291309
# headers: {}
310+
# status: "403"
292311
# # Unauthorized error template
293312
# unauthorizedError:
294313
# inBucket: false
295314
# path: ""
296315
# headers: {}
316+
# status: "401"
297317
# # Bad Request error template
298318
# badRequestError:
299319
# inBucket: false
300320
# path: ""
301321
# headers: {}
322+
# status: "400"
323+
# # PUT template
324+
# put:
325+
# inBucket: false
326+
# path: ""
327+
# headers: {}
328+
# status: "204"
329+
# # DELETE template
330+
# delete:
331+
# inBucket: false
332+
# path: ""
333+
# headers: {}
334+
# status: "204"
302335
## Bucket configuration
303336
bucket:
304337
name: super-bucket

docs/configuration/example.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,30 +84,45 @@ log:
8484
# path: templates/target-list.tpl
8585
# headers:
8686
# Content-Type: '{{ template "main.headers.contentType" . }}'
87+
# status: "200"
8788
# folderList:
8889
# path: templates/folder-list.tpl
8990
# headers:
9091
# Content-Type: '{{ template "main.headers.contentType" . }}'
92+
# status: "200"
9193
# badRequestError:
9294
# path: templates/bad-request-error.tpl
9395
# headers:
9496
# Content-Type: '{{ template "main.headers.contentType" . }}'
97+
# status: "400"
9598
# forbiddenError:
9699
# path: templates/forbidden-error.tpl
97100
# headers:
98101
# Content-Type: '{{ template "main.headers.contentType" . }}'
102+
# status: "403"
99103
# internalServerError:
100104
# path: templates/internal-server-error.tpl
101105
# headers:
102106
# Content-Type: '{{ template "main.headers.contentType" . }}'
107+
# status: "500"
103108
# notFoundError:
104109
# path: templates/not-found-error.tpl
105110
# headers:
106111
# Content-Type: '{{ template "main.headers.contentType" . }}'
112+
# status: "404"
107113
# unauthorizedError:
108114
# path: templates/unauthorized-error.tpl
109115
# headers:
110116
# Content-Type: '{{ template "main.headers.contentType" . }}'
117+
# status: "401"
118+
# put:
119+
# path: templates/put.tpl
120+
# headers: {}
121+
# status: "204"
122+
# delete:
123+
# path: templates/delete.tpl
124+
# headers: {}
125+
# status: "204"
111126

112127
# Authentication Providers
113128
# authProviders:
@@ -284,31 +299,49 @@ targets:
284299
# inBucket: false
285300
# path: ""
286301
# headers: {}
302+
# status: "200"
287303
# # Not found error template
288304
# notFoundError:
289305
# inBucket: false
290306
# path: ""
291307
# headers: {}
308+
# status: "404"
292309
# # Internal server error template
293310
# internalServerError:
294311
# inBucket: false
295312
# path: ""
296313
# headers: {}
314+
# status: "500"
297315
# # Forbidden error template
298316
# forbiddenError:
299317
# inBucket: false
300318
# path: ""
301319
# headers: {}
320+
# status: "403"
302321
# # Unauthorized error template
303322
# unauthorizedError:
304323
# inBucket: false
305324
# path: ""
306325
# headers: {}
326+
# status: "401"
307327
# # Bad Request error template
308328
# badRequestError:
309329
# inBucket: false
310330
# path: ""
311331
# headers: {}
332+
# status: "400"
333+
# # PUT template
334+
# put:
335+
# inBucket: false
336+
# path: ""
337+
# headers: {}
338+
# status: "204"
339+
# # DELETE template
340+
# delete:
341+
# inBucket: false
342+
# path: ""
343+
# headers: {}
344+
# status: "204"
312345
## Bucket configuration
313346
bucket:
314347
name: super-bucket

docs/configuration/structure.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,26 @@ This feature is powered by [go-chi/cors](https://github.com/go-chi/cors). You ca
8181
Override headers will remove the default value containing the `Content-Type` header. Why ? Because it was though that it was better to know why it is override and not have magical values coming from nowhere.
8282
<!-- prettier-ignore-end -->
8383

84-
| Key | Type | Required | Default | Description |
85-
| ------------------- | ------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
86-
| helpers | [String] | No | `[templates/_helpers.tpl]`  | Template Golang helpers |
87-
| targetList | [TemplateConfigurationItem](#templateconfigurationitem) | No | `targetList: { path: "templates/target-list.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" } }` | Target list template path. More information [here](../feature-guide/templates.md#generic-case). |
88-
| folderList | [TemplateConfigurationItem](#templateconfigurationitem) | No | `folderList: { path: "templates/folder-list.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" } }` | Folder list template path. More information [here](../feature-guide/templates.md#generic-case). |
89-
| notFoundError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `notFoundError: { path: "templates/not-found-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" } }` | Not found template path. More information [here](../feature-guide/templates.md#generic-case). |
90-
| unauthorizedError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `unauthorizedError: { path: "templates/unauthorized-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" } }` | Unauthorized template path. More information [here](../feature-guide/templates.md#generic-case). |
91-
| forbiddenError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `forbiddenError: { path: "templates/forbidden-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" } }` | Forbidden template path. More information [here](../feature-guide/templates.md#generic-case). |
92-
| badRequestError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `badRequestError: { path: "templates/bad-request-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" } }` | Bad Request template path. More information [here](../feature-guide/templates.md#generic-case). |
93-
| internalServerError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `internalServerError: { path: "templates/internal-server-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" } }` | Internal server error template path. More information [here](../feature-guide/templates.md#generic-case). |
84+
| Key | Type | Required | Default | Description |
85+
| ------------------- | ------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
86+
| helpers | [String] | No | `[templates/_helpers.tpl]`  | Template Golang helpers |
87+
| targetList | [TemplateConfigurationItem](#templateconfigurationitem) | No | `targetList: { path: "templates/target-list.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" }, status: "200" }` | Target list template configuration. More information [here](../feature-guide/templates.md). |
88+
| folderList | [TemplateConfigurationItem](#templateconfigurationitem) | No | `folderList: { path: "templates/folder-list.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" }, status: "200" }` | Folder list template configuration. More information [here](../feature-guide/templates.md). |
89+
| notFoundError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `notFoundError: { path: "templates/not-found-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" }, status: "404" }` | Not found template configuration. More information [here](../feature-guide/templates.md). |
90+
| unauthorizedError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `unauthorizedError: { path: "templates/unauthorized-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" }, status: "401" }` | Unauthorized template configuration. More information [here](../feature-guide/templates.md). |
91+
| forbiddenError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `forbiddenError: { path: "templates/forbidden-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" }, status: "403" }` | Forbidden template configuration. More information [here](../feature-guide/templates.md). |
92+
| badRequestError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `badRequestError: { path: "templates/bad-request-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" }, status: "400" }` | Bad Request template configuration. More information [here](../feature-guide/templates.md). |
93+
| internalServerError | [TemplateConfigurationItem](#templateconfigurationitem) | No | `internalServerError: { path: "templates/internal-server-error.tpl", headers: { "Content-Type": "{{ template \"main.headers.contentType\" . }}" }, status: "500" }` | Internal server error template configuration. More information [here](../feature-guide/templates.md). |
94+
| put | [TemplateConfigurationItem](#templateconfigurationitem) | No | `put: { path: "templates/put.tpl", headers: {}, status: "204" }` | PUT response template configuration. More information [here](../feature-guide/templates.md). |
95+
| delete | [TemplateConfigurationItem](#templateconfigurationitem) | No | `delete: { path: "templates/put.tpl", headers: {}, status: "204" }` | DELETE response template configuration. More information [here](../feature-guide/templates.md). |
9496

9597
## TemplateConfigurationItem
9698

9799
| Key | Type | Required | Default | Description |
98100
| ------- | ----------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99101
| path | String | True | `""` | File path to template file |
100102
| headers | Map[String]String | False | None | Headers containing templates. Key corresponds to header and value to the template. If templated value is empty, the header won't be added to answer. More information [here](../feature-guide/templates.md#generic-case). |
103+
| status | String | False | `""` | Status code template. It will be parsed to get an integer. |
101104

102105
## TargetConfiguration
103106

@@ -125,11 +128,13 @@ See more information [here](../feature-guide/key-rewrite.md).
125128
| ------------------- | ----------------------------------------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------- |
126129
| helpers | [[TargetHelperConfigItem](#targethelperconfigitem)] | No | None | Helpers list custom template declarations. |
127130
| folderList | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Folder list custom template declaration. More information [here](../feature-guide/templates.md). |
128-
| notFound | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Not Found custom template declaration. More information [here](../feature-guide/templates.md). |
131+
| notFoundError | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Not Found custom template declaration. More information [here](../feature-guide/templates.md). |
129132
| internalServerError | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Internal server error custom template declaration. More information [here](../feature-guide/templates.md). |
130-
| forbidden | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Forbidden custom template declaration. More information [here](../feature-guide/templates.md). |
131-
| unauthorized | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Unauthorized custom template declaration. More information [here](../feature-guide/templates.md). |
132-
| badRequest | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Bad Request custom template declaration. More information [here](../feature-guide/templates.md). |
133+
| forbiddenError | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Forbidden custom template declaration. More information [here](../feature-guide/templates.md). |
134+
| unauthorizedError | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Unauthorized custom template declaration. More information [here](../feature-guide/templates.md). |
135+
| badRequestError | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | Bad Request custom template declaration. More information [here](../feature-guide/templates.md). |
136+
| put | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | PUT custom template declaration. More information [here](../feature-guide/templates.md). |
137+
| delete | [TargetTemplateConfigItem](#targettemplateconfigitem) | No | None | DELETE custom template declaration. More information [here](../feature-guide/templates.md). |
133138

134139
## TargetHelperConfigItem
135140

@@ -145,6 +150,7 @@ See more information [here](../feature-guide/key-rewrite.md).
145150
| inBucket | Boolean | No | `false` | Is the file in bucket or on local file system ? |
146151
| path | String | Yes | None | Path for template file |
147152
| headers | Map[String]String | False | This will be set to corresponding [TemplateConfiguration](#templateconfiguration) if empty. | Headers containing templates. Key corresponds to header and value to the template. If templated value is empty, the header won't be added to answer. More information [here](../feature-guide/templates.md#generic-case). |
153+
| status | String | Yes | None | Status code template. It will be parsed to get an integer. |
148154

149155
## ActionsConfiguration
150156

0 commit comments

Comments
 (0)