On this page:

17.4Module Config Endpoint

 

The Module Config endpoint is used to configure and control the nodes and modules in your cluster. It can be used to query for module configuration, update it, and start/stop the modules in the cluster.

17.4.1Fetch Config: Module Property File

 
This method requires the VIEW_MODULE_CONFIG permission.

This method will return a complete Smile CDR configuration property file. This is useful for example if you want to export a complete configuration from one environment in order to build another environment.


To invoke:

GET http://localhost:9000/module-config/properties

The server will produce a response resembling the following:

################################################################################
# 	 Master
################################################################################
node.id=Master
node.control.port=7001

################################################################################
# 	 admin_json
################################################################################
module.admin_json.type=ADMIN_JSON
module.admin_json.requires.SECURITY_IN_UP=local_security
module.admin_json.config.cors.origins=*
module.admin_json.config.context_path=/
module.admin_json.config.threadpool.max=10
module.admin_json.config.sessions.timeout.mins=30
module.admin_json.config.threadpool.min=5
module.admin_json.config.sessions.scavenger.interval.millis=60000
module.admin_json.config.port=9000

For brevity only 1 module and a small subset of its configuration are shown but a real response might contain many more.

17.4.2Fetch Config: All Modules

 
This method requires the VIEW_MODULE_CONFIG permission.

This method will return the complete configuration for the modules in your cluster. Note that passwords for external systems (e.g. database credentials) will be obscured.


To invoke:

GET http://localhost:9000/module-config/

The server will produce a response resembling the following:

{
  "nodes": [
    {
      "nodeId": "Master",
      "modules": [
        {
          "moduleId": "clustermgr",
          "moduleType": "CLUSTER_MGR",
          "options": [
            {
              "key": "kafka.ack_mode"
            },
            {
              "key": "db.driver",
              "value": "POSTGRES_9_4"
            },
            {
              "key": "db.url",
              "value": "jdbc:postgresql://localhost/cdr"
            },
            {
              "key": "db.username",
              "value": "cdr"
            }
          ]
        },
        {
          "moduleId": "local_security",
          "moduleType": "SECURITY_IN_LOCAL",
          "options": [
            {
              "key": "seed.username",
              "value": "admin"
            }
          ]
        },
        {
          "moduleId": "smart_app_demo_host",
          "moduleType": "SMART_APPS_HOST",
          "options": [
            {
              "key": "port",
              "value": "19201"
            },
            {
              "key": "respect_forward_headers",
              "value": "true"
            }
          ]
        }
      ]
    }
  ]
}

For brevity only 1 module and a small subset of its configuration are shown but a real response might contain many more.

17.4.3Fetch Config: Single Module

 
This method requires the VIEW_MODULE_CONFIG permission.

This method will return the complete configuration for a given module. Note that passwords for external systems (e.g. database credentials) will be obscured.


To invoke (substitute a node ID and module ID into the path below):

GET http://localhost:9000/module-config/{node_id}/{module_id}

The server will produce a response resembling the following:

{
  "moduleType": "ADMIN_JSON",
  "options": [
    {
      "key": "port",
      "value": "19000"
    },
    {
      "key": "respect_forward_headers",
      "value": "true"
    },
    {
      "key": "anonymous.access.enabled",
      "value": "true"
    },
    {
      "key": "security.http.basic.enabled",
      "value": "true"
    }
  ],
  "dependencies": [
    {
      "moduleId": "local_security",
      "type": "SECURITY_IN_UP"
    }
  ]
}

Note that only settings which are not set to their default value are included in the response.

17.4.4Create Module

 
This method requires the CREATE_MODULE permission.

This method instantiates a new module.


To invoke (substitute a node ID and module ID into the path below):

POST http://localhost:9000/module-config/{node_id}/{module_id}/create
Content-Type: application/json

This call should include a body such as the following:

{
  "moduleType": "ENDPOINT_FHIR_REST_DSTU3",
  "options": [
    {
      "key": "anonymous.access.enabled",
      "value": "true"	
    }
  ],
  "dependencies": [
    {
      "type": "PERSISTENCE_DSTU3",
      "moduleId": "persistence"
    },
    {
      "type": "SECURITY_IN_OIC",
      "moduleId": "smart_auth"
    },
    {
      "type": "SECURITY_IN_UP",
      "moduleId": "local_security"
    }
  ]
}

In this example, a new module will be created with id {module_id} and the options and dependencies as they were set in the request body.

The module Types that can be created are listed Here

You can find the applicable options for each module type under the Modules heading.

The server will produce a response resembling the following:

{
  "options": [
    {
      "name": "cors.origins",
      "previousValue": "https://example.com",
      "newValue": "*"
    }
  ]
}

17.4.5Set Module Config

 
This method requires the UPDATE_MODULE_CONFIG permission.

This method updates configuration for a given module. This can include changing dependencies and updating configuration properties. Any number of dependencies and properties can be changed.


To invoke (substitute a node ID and module ID into the path below):

PUT http://localhost:9000/module-config/{node_id}/{module_id}/set
Content-Type: application/json

This call should include a body such as the following:

{
  "options": [
    {
      "key": "cors.origins",
      "value": "*"
    }
  ]
}

Each option has two parts:

  • The key is the property key, such as the value security.http.basic.enabled listed here.
  • The value is the actual value to set

In this example, a single configuration item is being updated but many could be updated at one time.

The server will produce a response resembling the following:

{
  "options": [
    {
      "key": "cors.origins",
      "previousValue": "https://example.com",
      "newValue": "*"
    }
  ]
}

17.4.6Start Module

 
This method requires the CONTROL_MODULE permission.

This method starts a given module if it isn't already running or in the process of starting (in which case this method has no effect).


To invoke (substitute a node ID and module ID into the path below):

POST http://localhost:9000/module-config/{node_id}/{module_id}/start

The server will produce a response resembling the following:

{
  "moduleId": "admin_web",
  "previousStatus": "STOPPED",
  "newStatus": "START_REQUESTED"
}

17.4.7Stop Module

 
This method requires the CONTROL_MODULE permission.

This method stops a given module if it isn't already stopped or in the process of stopping (in which case this method has no effect).


To invoke (substitute a node ID and module ID into the path below):

POST http://localhost:9000/module-config/{node_id}/{module_id}/stop

The server will produce a response resembling the following:

{
  "moduleId": "admin_web",
  "previousStatus": "STARTED",
  "newStatus": "STOP_REQUESTED"
}

17.4.8Restart Module

 
This method requires the CONTROL_MODULE permission.

This method restarts a given module if it isn't already in the process of starting or stopping (in which case this method has no effect).


To invoke (substitute a node ID and module ID into the path below):

POST http://localhost:9000/module-config/{node_id}/{module_id}/restart

The server will produce a response resembling the following:

{
  "moduleId": "admin_web",
  "previousStatus": "STARTED",
  "newStatus": "RESTART_REQUESTED"
}

17.4.9Archive Module

 
This method requires the ARCHIVE_MODULE permission.

This method archives a given module. Note that this is a logical delete; the module will be retained in the database because audit logs and other elements may depend on it. It will be marked as "archived", a random string will be appended to its ID, and it will no longer appear in the list of modules.


To invoke (substitute a node ID and module ID into the path below):

DELETE http://localhost:9000/module-config/{node_id}/{module_id}/archive