Skip to content

Commit

Permalink
Merge pull request #244 from oxyno-zeta/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyno-zeta committed Feb 8, 2022
2 parents 7328689 + 5356f28 commit ea283f7
Show file tree
Hide file tree
Showing 24 changed files with 1,611 additions and 1,373 deletions.
33 changes: 33 additions & 0 deletions conf/config-example.yaml
Expand Up @@ -74,30 +74,45 @@ log:
# path: templates/target-list.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "200"
# folderList:
# path: templates/folder-list.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "200"
# badRequestError:
# path: templates/bad-request-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "400"
# forbiddenError:
# path: templates/forbidden-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "403"
# internalServerError:
# path: templates/internal-server-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "500"
# notFoundError:
# path: templates/not-found-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "404"
# unauthorizedError:
# path: templates/unauthorized-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "401"
# put:
# path: templates/put.tpl
# headers: {}
# status: "204"
# delete:
# path: templates/delete.tpl
# headers: {}
# status: "204"

# Authentication Providers
# authProviders:
Expand Down Expand Up @@ -274,31 +289,49 @@ targets:
# inBucket: false
# path: ""
# headers: {}
# status: "200"
# # Not found error template
# notFoundError:
# inBucket: false
# path: ""
# headers: {}
# status: "404"
# # Internal server error template
# internalServerError:
# inBucket: false
# path: ""
# headers: {}
# status: "500"
# # Forbidden error template
# forbiddenError:
# inBucket: false
# path: ""
# headers: {}
# status: "403"
# # Unauthorized error template
# unauthorizedError:
# inBucket: false
# path: ""
# headers: {}
# status: "401"
# # Bad Request error template
# badRequestError:
# inBucket: false
# path: ""
# headers: {}
# status: "400"
# # PUT template
# put:
# inBucket: false
# path: ""
# headers: {}
# status: "204"
# # DELETE template
# delete:
# inBucket: false
# path: ""
# headers: {}
# status: "204"
## Bucket configuration
bucket:
name: super-bucket
Expand Down
33 changes: 33 additions & 0 deletions docs/configuration/example.md
Expand Up @@ -84,30 +84,45 @@ log:
# path: templates/target-list.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "200"
# folderList:
# path: templates/folder-list.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "200"
# badRequestError:
# path: templates/bad-request-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "400"
# forbiddenError:
# path: templates/forbidden-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "403"
# internalServerError:
# path: templates/internal-server-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "500"
# notFoundError:
# path: templates/not-found-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "404"
# unauthorizedError:
# path: templates/unauthorized-error.tpl
# headers:
# Content-Type: '{{ template "main.headers.contentType" . }}'
# status: "401"
# put:
# path: templates/put.tpl
# headers: {}
# status: "204"
# delete:
# path: templates/delete.tpl
# headers: {}
# status: "204"

# Authentication Providers
# authProviders:
Expand Down Expand Up @@ -284,31 +299,49 @@ targets:
# inBucket: false
# path: ""
# headers: {}
# status: "200"
# # Not found error template
# notFoundError:
# inBucket: false
# path: ""
# headers: {}
# status: "404"
# # Internal server error template
# internalServerError:
# inBucket: false
# path: ""
# headers: {}
# status: "500"
# # Forbidden error template
# forbiddenError:
# inBucket: false
# path: ""
# headers: {}
# status: "403"
# # Unauthorized error template
# unauthorizedError:
# inBucket: false
# path: ""
# headers: {}
# status: "401"
# # Bad Request error template
# badRequestError:
# inBucket: false
# path: ""
# headers: {}
# status: "400"
# # PUT template
# put:
# inBucket: false
# path: ""
# headers: {}
# status: "204"
# # DELETE template
# delete:
# inBucket: false
# path: ""
# headers: {}
# status: "204"
## Bucket configuration
bucket:
name: super-bucket
Expand Down
34 changes: 20 additions & 14 deletions docs/configuration/structure.md
Expand Up @@ -81,23 +81,26 @@ This feature is powered by [go-chi/cors](https://github.com/go-chi/cors). You ca
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.
<!-- prettier-ignore-end -->

| Key | Type | Required | Default | Description |
| ------------------- | ------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| helpers | [String] | No | `[templates/_helpers.tpl]`  | Template Golang helpers |
| 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). |
| 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). |
| 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). |
| 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). |
| 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). |
| 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). |
| 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). |
| Key | Type | Required | Default | Description |
| ------------------- | ------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| helpers | [String] | No | `[templates/_helpers.tpl]`  | Template Golang helpers |
| 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). |
| 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). |
| 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). |
| 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). |
| 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). |
| 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). |
| 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). |
| put | [TemplateConfigurationItem](#templateconfigurationitem) | No | `put: { path: "templates/put.tpl", headers: {}, status: "204" }` | PUT response template configuration. More information [here](../feature-guide/templates.md). |
| delete | [TemplateConfigurationItem](#templateconfigurationitem) | No | `delete: { path: "templates/put.tpl", headers: {}, status: "204" }` | DELETE response template configuration. More information [here](../feature-guide/templates.md). |

## TemplateConfigurationItem

| Key | Type | Required | Default | Description |
| ------- | ----------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| path | String | True | `""` | File path to template file |
| 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). |
| status | String | False | `""` | Status code template. It will be parsed to get an integer. |

## TargetConfiguration

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

## TargetHelperConfigItem

Expand All @@ -145,6 +150,7 @@ See more information [here](../feature-guide/key-rewrite.md).
| inBucket | Boolean | No | `false` | Is the file in bucket or on local file system ? |
| path | String | Yes | None | Path for template file |
| 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). |
| status | String | Yes | None | Status code template. It will be parsed to get an integer. |

## ActionsConfiguration

Expand Down

0 comments on commit ea283f7

Please sign in to comment.