-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from sevenval/develop
Release 20200519
- Loading branch information
Showing
13 changed files
with
277 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Docker | ||
|
||
The _FLAT Server_ is publicly available as a [Docker](https://www.docker.com) image: | ||
https://hub.docker.com/r/sevenvaltechnologies/flatrunner | ||
So, make sure you have Docker installed on your system or an alternative means to | ||
download and run Docker images off Docker Hub. | ||
|
||
## Images | ||
|
||
The [`latest`](https://hub.docker.com/r/sevenvaltechnologies/flatrunner/tags?name=latest) | ||
image provides you with the most recent stable official release. | ||
A [`beta`](https://hub.docker.com/r/sevenvaltechnologies/flatrunner/tags?name=beta) | ||
image with brand-new [features](/CHANGELOG.md) is also available. | ||
|
||
You can use the [`flat`](/reference/flat-cli.md) command line tool | ||
to pull the latest release or beta image: | ||
|
||
```sh | ||
$ flat pull | ||
``` | ||
|
||
or | ||
|
||
```sh | ||
$ flat pull -b | ||
``` | ||
|
||
## Container | ||
|
||
To run the server, simply start the Docker container with the | ||
[`flat`](/reference/flat-cli.md) CLI: | ||
|
||
```sh | ||
$ flat start | ||
``` | ||
|
||
Add the `-b` option to start a container based on the `beta` release: | ||
|
||
```sh | ||
$ flat start -b | ||
``` | ||
|
||
To use a specific image, provide the respective release number as `TAG` | ||
environment variable, for example | ||
|
||
```sh | ||
$ TAG=20200409 flat start | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# `error` Action | ||
|
||
The `error` action provides a simple and consistent way to handle errors throughout the configuration. | ||
|
||
It terminates the flow, sets its body template result as [`$error`](/reference/variables.md#usderror) and calls the [error flow](/reference/OpenAPI/routing.md#error-flow), if configured, or sends the [system error document](/reference/OpenAPI/validation.md#system-error-document) with the body template result as the value of the `error` property. | ||
|
||
In its simplest form, an error is triggered like this: | ||
|
||
```xml | ||
<error/> | ||
``` | ||
|
||
To make errors more useful, they should contain a message: | ||
|
||
```xml | ||
<error> | ||
{ | ||
"message": "Upstream system sent unusable data" | ||
} | ||
</error> | ||
``` | ||
|
||
## Error Properties | ||
|
||
The action body contains a constant JSON string or a [JSON template](/reference/templating/README.md) representing a JSON object. | ||
The object will be assigned to the `$error` variable. | ||
|
||
The following properties of the `$error` object are optional, but must have the specified | ||
type if set. If not set, they will receive the following default values: | ||
|
||
* `message`: `string`, default: `'FlowError'` | ||
* `status`: `integer` between 100 and 599, default: `500` | ||
* `code`: `integer` between 0 and 9999, default: `5000` | ||
* `info`: `array` of `string`, default: `["Flow Error triggered"]` | ||
|
||
Additional properties are allowed. They will be accessible in the Error Flow. The following example includes the URL in `$error/url`: | ||
|
||
```xml | ||
<error> | ||
{ | ||
{{: $request/url }} | ||
"message": "Upstream system sent unusable data", | ||
"status": 502, | ||
"code": 4711 | ||
} | ||
</error> | ||
``` | ||
|
||
## Status Code | ||
|
||
The `status` property will be used as the HTTP response status code. The status code may alternatively be defined with the optional `status` attribute. | ||
|
||
```xml | ||
<error status="403"/> | ||
``` | ||
|
||
```xml | ||
<error status="502"> | ||
{ | ||
"message": "Upstream system sent unusable data" | ||
} | ||
</error> | ||
``` | ||
|
||
## Fixed message shortcut | ||
|
||
If the action body is a string constant (it must be enclosed in double quotes), its value will be | ||
assigned to the `$error/message` property. This is a handy shortcut to trigger simple errors with fixed messages: | ||
|
||
```xml | ||
<error status="502"> "Upstream system sent unusable data" </error> | ||
``` | ||
|
||
## Logging | ||
|
||
The `error` emits an [error log](/administration/logging.md#error-log) event with the `error` topic and the given `message`: | ||
|
||
```json | ||
{ | ||
"timestamp": "2020-05-19T16:27:46+00:00", | ||
"type": "flat_alert", | ||
"requestID": "XsQJAMvNgp1P2qKAxKmdaAAAAAI", | ||
"topic": "error", | ||
"message": "Upstream system sent unusable data" | ||
} | ||
``` | ||
|
||
## See also | ||
|
||
* [Error Flow](/reference/OpenAPI/routing.md#error-flow) | ||
* [`$error`](/reference/variables.md#usderror) | ||
* [Handling Errors](/cookbook/error-flow.md) (Cookbook) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.