.env variables
The .env file, at the root of the application, holds the whole server configuration. The .env.example template, delivered with the application, lists each variable with its comment: copy it as .env, then fill it in (see Configuring the server).
An empty value takes the default value. After each change, restart the server and check its logs.
Server
| Variable | Required | Default | Purpose |
|---|---|---|---|
NODE_ENV | Yes | production on a real server. | |
LOG_LEVEL | No | warn | error, warn, info, http or debug. info is recommended. |
SERVER_PROTOCOL | Yes | https | https: the server handles its certificate; http: behind a proxy that handles HTTPS. |
SERVER_PORT | No | 4999 | Listening port. |
SERVER_TRUST_PROXY | No | Behind a proxy: number of proxies (e.g. 1) or their IP addresses. | |
TLS_KEY_FILE | In https mode | Private key of the certificate, in PEM format. | |
TLS_CERT_FILE | In https mode | Certificate followed by the intermediate certificates, in PEM format. |
File paths are absolute, or relative to the application folder.
License and texts
| Variable | Required | Default | Purpose |
|---|---|---|---|
LICENSE_FILE | No | license.lic | License file (see Installing and renewing the license). |
LICENSE_USERS_FILE | No | data/license-users.json | Registry of counted users, for a limited license. The server must be able to write to its folder. |
TRANSLATIONS_OVERRIDE_DIR | No | Folder of your own texts (see Customizing the panel texts). |
Sign-in and cookies
| Variable | Required | Default | Purpose |
|---|---|---|---|
OAUTH_CALLBACK_URI | Yes | Public address of the server followed by /auth/callback, declared identically in the target system's OAuth2 client. | |
OAUTH_COOKIE_CRYPTO_KEY | Yes | Token encryption key: 32 bytes encoded in base64. | |
OAUTH_COOKIE_SIGN_KEY | Yes | Cookie signing key, different from the previous one. Changing it signs out all users. | |
OAUTH_COOKIE_MAXAGE | No | 7 days | Session duration, in milliseconds. |
COOKIE_PREFIX | No | Prefix of the cookie names, only for two Save2ERP servers on the same host name (see Cookies). | |
MAX_LOGGED_BODY_LENGTH | No | 1000 | Maximum size of a target system error response copied to the logs. |
To generate a key:
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"SAP systems: common values
These values apply to all the SAP systems of the installation. Each one can be overridden for a system by the SAP_<system>_… variable of the same name (see below).
| Variable | Required | Default | Purpose |
|---|---|---|---|
SAP_OAUTH_SCOPE | Yes, unless each system has its own | OAuth2 scope of the attachments service. | |
SAP_ATTACHMENTS_PATH | No | /attachments | Path of the upload service. |
SAP_CHECK_PATH | No | /attachments/check | Path of the check service. |
SAP_HEALTHCHECK_PATH | No | /attachments/healthcheck | Path of the test service. |
SAP_PERMISSIONS_PATH | No | /attachments/permissions | Path of the user permissions service (designer mode). |
SAP_TEMPLATE_PATH | No | /attachments/readTemplateXml | Path of the template service (designer mode). |
SAP_CALL_TIMEOUT_MS | No | 60000 | Maximum time to wait for a response, in milliseconds. |
SAP_ICON | No | SAP icon | Icon of the pane: .svg or .png file. |
SAP systems: one block per system
<system> is the SAP logical system, as it appears in the S2E_SystemKey property of the documents (e.g. P01CLNT100). A system is only available if all its required variables are set.
| Variable | Required | Purpose |
|---|---|---|
SAP_<system>_ENV | Yes | SBX, DEV, QUAL or PROD: sets the color of the pane. |
SAP_<system>_SID | Yes | System ID. |
SAP_<system>_MANDT | Yes | Client. |
SAP_<system>_APIBASE | Yes | Base address of the REST services, without a trailing /. |
SAP_<system>_OAUTH_SERVER | Yes | Address of SAP's OAuth2 server. |
SAP_<system>_OAUTH_CLIENT_ID | Yes | ID of the OAuth2 client registered in SAP. |
SAP_<system>_OAUTH_CLIENT_SECRET | Yes | Secret of this client. |
SAP_<system>_APIKEYNAME, SAP_<system>_APIKEY | No | Header name and value of the API key required by a gateway. |
SAP_<system>_COLOR | No | Button color in "#RRGGBB" format (in quotes), instead of the environment's color. |
SAP_<system>_ICON | No | Icon of the pane for this system. |
SAP_<system>_OAUTH_SCOPE, _ATTACHMENTS_PATH, _CHECK_PATH, _HEALTHCHECK_PATH, _PERMISSIONS_PATH, _TEMPLATE_PATH, _CALL_TIMEOUT_MS | No | Override the common value for this system. |
Invalid values
An invalid path, a timeout that is not a positive whole number, or a missing icon make the system unusable: documents of this system show the "System misconfigured" error, and the cause is written to the logs at startup.
Never disable certificate verification
Never set NODE_TLS_REJECT_UNAUTHORIZED=0. If the target system uses a certificate issued by an internal authority, give the path of that authority's certificate (PEM format) in the server's NODE_EXTRA_CA_CERTS environment variable (see Requirements).