Building and running the connector server
To deploy a connector to a production instance of i2 Analyze that includes the i2 Connect gateway, the SDK includes commands for:
Building the service code without starting the server
Starting the connector server and its services as they were last built
To build the services and do nothing else:
npm run build
To run a server whose services have already been built:
npm run serve
When you deploy to a production instance of i2 Analyze, you must ensure that the target system's command access control settings are configured so that its users can see your connector. The procedure for doing so is the same as it is during development and testing.
Configuring the connector server
You can configure the connector server in a particular connector project through the settings file at config/server.json, or by using environment variables. In new projects, the generated settings file contains the minimum amount of configuration to get your connector server running. You should review the settings to ensure that they are appropriate for your deployment:
{
"serverPort": 3000,
"connectorId": "<populated at creation>",
"ssl": {
"enabled": false,
"serverPort": 3443,
"privateKeyFile": "",
"certificateFile": "",
"gatewayCN": "",
"caCertificateFile": ""
},
"log": {
"level": "info",
"fileLogging": {
"enabled": false,
"dir": ""
}
},
"requestOrigin": {
"frontEndUri": "",
"frontEndUriPath": ""
},
"jwtCertificateFile": ""
}
The table below describes the settings and provides the names of the environment variables that you can use to override them.
| JSON setting | Environment variable | Type | Description |
|---|---|---|---|
serverPort |
SERVER_PORT |
number | The port number for connections to the connector server. |
connectorId |
CONNECTOR_ID |
string | The identifier of the connector. |
ssl.enabled |
SSL_ENABLED |
boolean | Whether SSL is enabled. |
ssl.serverPort |
SSL_SERVER_PORT |
number | The port number for SSL connections to the connector server. |
ssl.privateKeyFile |
SSL_PRIVATE_KEY or SSL_PRIVATE_KEY_FILE |
string | The path to the .pem file for the key. An optional passphrase associated with this private key can be supplied in the environment variable SSL_PASSPHRASE. |
ssl.certificateFile |
SSL_CERTIFICATE or SSL_CERTIFICATE_FILE |
string | The path to the .pem file for the certificate. |
ssl.gatewayCN |
SSL_GATEWAY_CN |
string or string[] | The gateway common name or names. |
ssl.caCertificateFile |
SSL_CA_CERTIFICATE or SSL_CA_CERTIFICATE_FILE |
string | The path to the trusted CA certificate. |
log.level |
LOG_LEVEL |
string | The minimum message level to log. Messages at lower levels are ignored. The value can be one of the following:errorwarninfodebug |
log.fileLogging.enabled |
LOG_FILE_LOGGING_ENABLED |
boolean | Whether file logging is enabled. |
log.fileLogging.dir |
LOG_FILE_LOGGING_DIR |
string | The directory to log to. |
requestOrigin.frontEndUri |
FRONT_END_URI |
string | The connectors URI to use for file and resource references. When specified, this overrides all header-based detection. FRONT_END_URI_PATH shouldn't be set and will be ignored if this is used. Example: 'https://example.eia:9443/connectors/my-connector/api' |
requestOrigin.frontEndUriPath |
FRONT_END_URI_PATH |
string | The path component to append to the detected protocol and host for file and resource references. Useful if proxies are re-mapping the URI with additional paths. This will only matter if FRONT_END_URI isn't set. Example: '/connectors/my-connector/api' |
jwtCertificateFile |
JWT_CERTIFICATE_FILE or JWT_CERTIFICATE_FILE_PATH |
string | The path to the trusted JWT certificate file for verifying JWT tokens. JWT_CERTIFICATE_FILE would be the actual file content rather than the path to the file |