Skip to content
Snippets Groups Projects
Verified Commit 4137e8cc authored by Timm Fitschen's avatar Timm Fitschen
Browse files

DOC: update docs for server-side-scripting

parent 78d55f0d
Branches
Tags
No related merge requests found
...@@ -33,10 +33,29 @@ Users will need the ``SCRIPTING:EXECUTE:path:to:the:script`` permission. Here th ...@@ -33,10 +33,29 @@ Users will need the ``SCRIPTING:EXECUTE:path:to:the:script`` permission. Here th
For more information see the :doc:`specification of the API <../specs/Server-side-scripting>` For more information see the :doc:`specification of the API <../specs/Server-side-scripting>`
Environment
------------
The script is called with several special environment variables to accommodate
for its special location.
`HOME`
^^^^^^^^^^^^
To be able to run with reduced privileges, the script has its `HOME` environment
variable set to a special directory with write access. This directory will be
deleted after the script has terminated. Its content is freshly copied for each
script invocation from a skeleton directory, located in the server directory, in
`scripting/home/`. By default, this directory contains the following:
- `readme.md` :: A small text file describing the purpose of the directory.
Users of CaosDB are invited to populate the directory with whatever their
scripts need.
Invocation Invocation
------------ ------------
Server side scripts are triggered by sending a POST to the `/scripting` interface (see [API scripting](path??). There are the following arguments that can be provided: Server side scripts are triggered by sending a POST to the `/scripting` resource. There are the following arguments that can be provided:
- `call`: the name of the script to be called - `call`: the name of the script to be called
- `-pN`: positional arguments (e.g. `-p0`, `-p1` etc.) - `-pN`: positional arguments (e.g. `-p0`, `-p1` etc.)
...@@ -47,6 +66,7 @@ The arguments will be passed to the script. ...@@ -47,6 +66,7 @@ The arguments will be passed to the script.
An invocation via a button in javascript could look like: An invocation via a button in javascript could look like:
.. code-block:: javascript .. code-block:: javascript
var _make_sss_button = function (entity) { var _make_sss_button = function (entity) {
const script = "script.py"; const script = "script.py";
...@@ -63,21 +83,3 @@ An invocation via a button in javascript could look like: ...@@ -63,21 +83,3 @@ An invocation via a button in javascript could look like:
For more information see the :doc:`specification of the API <../specs/Server-side-scripting>` For more information see the :doc:`specification of the API <../specs/Server-side-scripting>`
Environment
------------
The script is called with several special environment variables to accommodate
for its special location.
`HOME`
^^^^^^^^^^^^
To be able to run with reduced privileges, the script has its `HOME` environment
variable set to a special directory with write access. This directory will be
deleted after the script has terminated. Its content is freshly copied for each
script invocation from a skeleton directory, located in the server directory, in
`scripting/home/`. By default, this directory contains the following:
- `readme.md` :: A small text file describing the purpose of the directory.
Users of CaosDB are invited to populate the directory with whatever their
scripts need.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment