Skip to content

.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 ​

VariableRequiredDefaultPurpose
NODE_ENVYesproduction on a real server.
LOG_LEVELNowarnerror, warn, info, http or debug. info is recommended.
SERVER_PROTOCOLYeshttpshttps: the server handles its certificate; http: behind a proxy that handles HTTPS.
SERVER_PORTNo4999Listening port.
SERVER_TRUST_PROXYNoBehind a proxy: number of proxies (e.g. 1) or their IP addresses.
TLS_KEY_FILEIn https modePrivate key of the certificate, in PEM format.
TLS_CERT_FILEIn https modeCertificate followed by the intermediate certificates, in PEM format.

File paths are absolute, or relative to the application folder.

License and texts ​

VariableRequiredDefaultPurpose
LICENSE_FILENolicense.licLicense file (see Installing and renewing the license).
LICENSE_USERS_FILENodata/license-users.jsonRegistry of counted users, for a limited license. The server must be able to write to its folder.
TRANSLATIONS_OVERRIDE_DIRNoFolder of your own texts (see Customizing the panel texts).

Sign-in and cookies ​

VariableRequiredDefaultPurpose
OAUTH_CALLBACK_URIYesPublic address of the server followed by /auth/callback, declared identically in the target system's OAuth2 client.
OAUTH_COOKIE_CRYPTO_KEYYesToken encryption key: 32 bytes encoded in base64.
OAUTH_COOKIE_SIGN_KEYYesCookie signing key, different from the previous one. Changing it signs out all users.
OAUTH_COOKIE_MAXAGENo7 daysSession duration, in milliseconds.
COOKIE_PREFIXNoPrefix of the cookie names, only for two Save2ERP servers on the same host name (see Cookies).
MAX_LOGGED_BODY_LENGTHNo1000Maximum size of a target system error response copied to the logs.

To generate a key:

bash
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).

VariableRequiredDefaultPurpose
SAP_OAUTH_SCOPEYes, unless each system has its ownOAuth2 scope of the attachments service.
SAP_ATTACHMENTS_PATHNo/attachmentsPath of the upload service.
SAP_CHECK_PATHNo/attachments/checkPath of the check service.
SAP_HEALTHCHECK_PATHNo/attachments/healthcheckPath of the test service.
SAP_PERMISSIONS_PATHNo/attachments/permissionsPath of the user permissions service (designer mode).
SAP_TEMPLATE_PATHNo/attachments/readTemplateXmlPath of the template service (designer mode).
SAP_CALL_TIMEOUT_MSNo60000Maximum time to wait for a response, in milliseconds.
SAP_ICONNoSAP iconIcon 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.

VariableRequiredPurpose
SAP_<system>_ENVYesSBX, DEV, QUAL or PROD: sets the color of the pane.
SAP_<system>_SIDYesSystem ID.
SAP_<system>_MANDTYesClient.
SAP_<system>_APIBASEYesBase address of the REST services, without a trailing /.
SAP_<system>_OAUTH_SERVERYesAddress of SAP's OAuth2 server.
SAP_<system>_OAUTH_CLIENT_IDYesID of the OAuth2 client registered in SAP.
SAP_<system>_OAUTH_CLIENT_SECRETYesSecret of this client.
SAP_<system>_APIKEYNAME, SAP_<system>_APIKEYNoHeader name and value of the API key required by a gateway.
SAP_<system>_COLORNoButton color in "#RRGGBB" format (in quotes), instead of the environment's color.
SAP_<system>_ICONNoIcon of the pane for this system.
SAP_<system>_OAUTH_SCOPE, _ATTACHMENTS_PATH, _CHECK_PATH, _HEALTHCHECK_PATH, _PERMISSIONS_PATH, _TEMPLATE_PATH, _CALL_TIMEOUT_MSNoOverride 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).