Applies to: reference, configuration, native-configuration

MOPS 4.0 Native Service Configuration

Overview

Structure

Below is a native service configuration file illustrated as a JSON diagram:

Shown below is the same file as plain text:

{
  "database": {
    // Define the database connection pools to be used
    "pools": {
      "pgdb": {
        "driver": "postgres",
        "connectionString": "postgres://user:password@node:port/db",
        "sqlStore": "C:\\mops\\data\\<service-name>.sql",
        "sqlVariant": "pgsql"
      },
      "mssql": {
        "driver": "odbc",
        "options": "driver options",
        "connectionString": "odbc-connection-string",
        "sqlStore": "C:\\mops\\data\\<service-name>.sql",
        "sqlVariant": "mssql"
      }
    },
    // Define the names we use to refer to the connection pools
    "names": {
      "accessname": "mssql"
    }
  },
  "security": {
    "jwks_cache": true,
    "jwks_cache_folder": "c:\\mops\\cache",
    "issuers": [
      "identity-issuer-url-1",
      "identity-issuer-url-2"
    ]
  },
  "http": {
    "address": "0.0.0.0",
    "port": 9993
  },
  "log": {
    "flushInterval": 50,
    "sinks": [
      {
        "type": "console"
      },
      {
        "type": "file",
        "path": "c:/mops/logs/<service-name>.log",
        "strategy": "rotating",
        "maxSize": 1024,
        "maxFiles": 100,
        "rotateOnOpen": false
      }
    ],
    "loggers": {
      // Level should be one of: trace debug info warn err critical off
      "default": {
        "level": "warn" 
      },
      "db": {
        "level": "warn"
      },
      "http": {
        "level": "warn"
      }
    }
  }
}

Fields

database (object)

Contains the setting related to database connections used by the service.

pools (object)

Defines connection pools and how each connection in the pool is established. Each member of the pools object specifies a connection pool and its name. Below referred to as pool-name.

pool-name (object)

Illustrated as pgsql and mssql above. The pool object defines a connection in a database and the system will maintain a number of concurrent connection to this database. The number of connections is based on workload.

driver (string)

The driver to be used when connecting to the database. Currently the following drivers are available:

  • postgres - A driver that connects to the PostgreSQL database.
  • odbc - A driver that connects to the Microsoft SQL Server database.
connectionString (string)

Connection details that specifies the node and database to connect to. The format of this string is specific to the database being connected to. For PostgreSQL, the format is:

  • postgres://user:password@node:port/db

For Microsoft SQL Server the format is:

  • Driver={ODBC Driver 18 for SQL Server};Server=node;Database=pqis;Initial Catalog=pqis;UID=username;PWD=password;TrustServerCertificate=yes

Each installation may use variations on these connection strings based on local requirements.

options (string)

Defines driver-specific options. For the odbc driver available options are:

Name Value Description
ODBC_ASYNC_METHOD POLLING Uses polling thread to determine when database requests have completed.
NOTIFICATION Uses ODBC notification support to notify of request completion (not available from all ODBC drivers).
NONE No asynchronous driver support. Requests will complete synchronously. This option value may number of possiblt concurrent requests to service.
Equivalent to selecting NONE.
ODBC_ASYNC_CONNECT TRUE Use asynchronous methods when connecting to database, not only when executing requests.
FALSE Do not use asynchronous requests when connecting to database.
sqlStore (string)

Services that supports more than one database type may use a SQL store. This setting specifies the path to this store. The store is to be considered as part of the delivered application not to be changes as configuration. Services packaged as containers place the sore inside the container and there is no need to make updates to this setting.

sqlVariant (string)

Specifies the name of the SQL variant to be used. The name comes from the variant defined in the SQL store. MOPS nomenclature use:

  • pgsql for PostgreSQL variant
  • mssql for Microsoft SQL Server variant

names (object)

Application services is accessing database connection by a name defined by the application service. The name is mapped to the connection pool using this name.

"names": {
	"accessname-1": "pool-name-1",
	"accessname-2": "pool-name-2",
	"accessname-3": "pool-name-3"
}

The accessname may not repeated more than once while the pool-name can be repeated. Effectively, this would be the case if more than one service connects to the same database using different access names.

security (object)

Security settings define how the application service operates on OpenID Connect/OAuth2 access validation.

jwks_cache (boolean)

The JWKS (JSON web token key set) cache flag define whether the service will cache the set of public keys provided by the OpenID Connect identity provider. This flag must be set to true if the service should be able to run without access to an external identity provider. Values for this setting is true or false.

jwks_cache_folder (string)

The JWKS cache folder specifies where to store cached JSON web token key set files. This path should preferably be the same path for all services updating or using the JWKS cache. On the system installation it should be mapped to host server folder:

  • INSTALLDIR/cache/jwks

The file saved in this folder will be named based on the identity issuer. Example: given an access token with issuer name https://adfs.mops-something.com/adfs. The file saved in the cache will created as:

  1. Remove scheme prefix (http:// or https://)
  2. Replace path separators (/) with exclamation mark (!).

The above issuer will this way get a cache file named adfs.mops-something.com!adfs.

See separate instruction on how to download a cache file manually if the server must be run without access to identity provider from the start.

issuers (array of strings)

The issuers array defines a list of issuers allowed by the application service. Note that the name listed need to be identical to the issuer name listed inside the access token. If the issuer url ends with a / then the url listed here need to end with /.

http (object)

Defines settings for the TCP/IP listener that implements the HTTP server protocol.

address (string)

Defines the network interface from which to accept TCP/IP connections. The 0.0.0.0 string accepts connections from all network interfaces.

port (integer number)

The TCP/IP port in which to accept connections.

log (object)

The log settings section define log targets and the amount of data written to the log.

flushInterval (number)

The period with which log entries are written to the output device, in seconds.

NOTE: This setting is under review and may disappear in future versions.

sinks (array of objects)

Defines a list of log targets.

type (string)

Selects a log target type. Available types are:

  • console - writes log entries to the standard console.
  • file - writes log entries to a text file.

path (string)

The path to and base name of log files.

strategy (string)

The strategy used for maintaining log file.

NOTE: This setting is under review and may change in future versions.

maxSize (number)

The max size of log files in kilobytes.

maxFiles (number)

The maximum number of log files to store.

rotateOnOpen (boolean)

Whether or not to switch to a new log file when starting the application. Values are true or false.

loggers (object)

Defines settings for the amount of log details to be written for different application functions. The following levels can be selected for the application functions listed below:

Level Description
trace All log information
debug Log debug information and below
info Log information messages and below
warn Log warning messages and below
err Log error messages and below
critical Log only critical error messages
off All logging turned off

The following application functions maintains individual log levels:

Name Description
default Logging not assigned to a specific application function
db General database API logging
http HTTP server or client logging
tls Logging related to TLS encryption
odbc ODBC database API driver logging
pgsql PostgreSQL database logging