mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Merge pull request #4315 from tusharxoxoxo/patch-4
Update add-runtime.md
This commit is contained in:
commit
844690e904
1 changed files with 5 additions and 7 deletions
|
|
@ -73,8 +73,7 @@ Internally the runtime can be anything you like as long as it follows the standa
|
|||
|
||||
The best way to go about writing a runtime is like so:
|
||||
Initialize a web server that runs on port 3000 and uses any IP Address (0.0.0.0) and on each `POST` request do the following:
|
||||
|
||||
1. Check that the `x-internal-challenge` header matches the `INTERNAL_RUNTIME_KEY` environment variable. If not return an error with a `401` status code and an `unauthorized` error message.
|
||||
1. Check that the `x-internal-challenge` header matches the `INTERNAL_RUNTIME_KEY` environment variable. If not, return an error with a `401` status code and an `unauthorized` error message.
|
||||
2. Decode the executor's JSON POST request. This normally looks like so:
|
||||
|
||||
```json
|
||||
|
|
@ -112,8 +111,8 @@ All errors that occur during the execution of a user's function **MUST** be retu
|
|||
|
||||
```json
|
||||
{
|
||||
"code": 500, // (Int) Use 404 if function not found or use 401 if the x-internal-challenge check failed.
|
||||
"message": "Error: Tried to divide by 0 \n /usr/code/index.js:80:7" // (String) Try to return a stacktrace and detailed error message if possible. This is shown to the user.
|
||||
"code": 500, // (Int) Use 404 if function not found or use 401 if the x-internal-challenge check fails.
|
||||
"message": "Error: Tried to divide by 0 \n /usr/code/index.js:80:7", // (String) Try to return a stacktrace and detailed error message if possible. This is shown to the user.
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -154,8 +153,7 @@ WORKDIR /usr/local/src
|
|||
COPY . /usr/local/src
|
||||
```
|
||||
|
||||
Next, you want to make sure you are adding execute permissions to any scripts you may run, the main ones are `build.sh` and `launch.sh`. You can run commands in Dockerfile's using the `RUN` prefix like so:
|
||||
|
||||
Next, you want to make sure you are adding execute permissions to any scripts you may run, the main ones are `build.sh` and `launch.sh`. You can run commands in Dockerfile using the `RUN` prefix like so:
|
||||
```
|
||||
RUN chmod +x ./build.sh
|
||||
RUN chmod +x ./launch.sh
|
||||
|
|
@ -220,7 +218,7 @@ $this->runtimes['dart'] = $dart;
|
|||
|
||||
This is an example of what you would do for a compiled language such as dart.
|
||||
|
||||
The first line is creating a new language entry, The first parameter is the internal name and the second one is the external one which is what the user will see in Appwrite.
|
||||
The first line is creating a new language entry. The first parameter is the internal name and the second one is the external one which is what the user will see in Appwrite.
|
||||
|
||||
The second line adds a new version to the language entry, I'll break down the parameters:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue