Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 4.55 KB

Advanced-Usage.md

File metadata and controls

52 lines (37 loc) · 4.55 KB

Advanced Usage

This page lists some of the advanced manuevers that may be of specific interest to help configure the package for use in your environment.

Environment Variables

To control the behavior of the MATLAB Proxy, you can optionally specify the environment variables described in this section. You must specify these variables before starting the integration. For example, a network license server can be specified when you start the integration using the command below:

env MLM_LICENSE_FILE="[email protected]" matlab-proxy-app

The following table describes all the environment variables that you can set to customize the behavior of this integration.

Name Type Example Value Description
MLM_LICENSE_FILE string "[email protected]" When you want to use either a license file or a network license manager to license MATLAB, specify this variable.
For example, specify the location of the network license manager to be 123@hostname.
MWI_BASE_URL string "/matlab" Set to control the base URL of the app. MWI_BASE_URL should start with / or be empty.
MWI_APP_PORT integer 8080 Specify the port for the HTTP server to listen on.
MWI_LOG_LEVEL string "CRITICAL" Specify the Python log level to be one of the following NOTSET, DEBUG, INFO, WARN, ERROR, or CRITICAL. For more information on Python log levels, see Logging Levels .
The default value is INFO.
MWI_LOG_FILE string "/tmp/logs.txt" Specify the full path to the file where you want debug logs from this integration to be written.
MWI_WEB_LOGGING_ENABLED string "True" Set this value to "true" to see additional web server logs.
MWI_CUSTOM_HTTP_HEADERS string '{"Content-Security-Policy": "frame-ancestors *.example.com:*"}'
OR
"/path/to/your/custom/http-headers.json"
Specify valid HTTP headers as JSON data in a string format.
Alternatively, specify the full path to the JSON file containing valid HTTP headers instead. These headers are injected into the HTTP response sent to the browser.
For more information, see the Custom HTTP Headers section.
TMPDIR or TMP string "/path/for/MATLAB/to/use/as/tmp" Set either one of these variables to control the temporary folder used by MATLAB. TMPDIR takes precedence over TMP and if neither variable is set, /tmp is the default value used by MATLAB.
MWI_SSL_CERT_FILE string "/path/to/certificate.pem" The certfile string must be the path to a single file in PEM format containing the certificate as well as any number of CA certificates needed to establish the certificate’s authenticity.
MWI_SSL_KEY_FILE string "/path/to/keyfile.key" The keyfile string, if present, must point to a file containing the private key in. Otherwise the private key will be taken from certfile as well.

Custom HTTP Headers

If the web browser renders the MATLAB Proxy with some other content, then the browser could block the integration because of mismatch of Content-Security-Policy header in the response headers from the integration. To avoid this, provide custom HTTP headers. This allows browsers to load the content.

For example, if this integration is rendered along with some other content on the domain www.example.com, to allow the browser to load the content, create a JSON file of the following form:

{
  "Content-Security-Policy": "frame-ancestors *.example.com:* https://www.example.com:*;"
}

Specify the full path to this sample file in the environment variable MWI_CUSTOM_HTTP_HEADERS. Alternatively, if you want to specify the custom HTTP headers as a string in the environment variable, in a bash shell type a command of the form below:

export MWI_CUSTOM_HTTP_HEADERS='{"Content-Security-Policy": "frame-ancestors *.example.com:* https://www.example.com:*;"}'

If you add the frame-ancestors directive, the browser does not block the content of this integration hosted on the domain www.example.com.

For more information about Content-Security-Policy header, check the Mozilla developer docs for Content-Security-Policy.

NOTE: Setting custom HTTP headers is an advanced operation, only use this functionality if you are familiar with HTTP headers.