How to switch on Multi-tenancy on Kodjin cluster

Headers and access token claims should be configured in Kodjin's infrastructure configuration file.

The configuration file provides information about URLs excluded from the multi-tenancy logic. The configuration file's path is - etc/kodjin/<environment>/values/fhir-config/multitenancy.json

Example of the file

{
  "enabled": true,
  "tenant": {
    "token_field": "practice_ids",
    "header_suffix": "tenant-id"
  },
  "exclude_resources": [
    "CapabilityStatement",
    "ImplementationGuide",
    "SearchParameter",
    "ValueSet",
    "CodeSystem",
    "ConceptMap",
    "StructureDefinition"
  ]
}

tenant - is a mandatory tenant information. When the MT is enabled, the tenant should be present in the file.

token_field - tenant name in the token claim.

header_suffix - internal header suffix, and tenant name in MongoDB. The header for request is combined from the stable part and config: x-kodjin-metadata-{header_suffix}

exclude_resources - resources that exist for all tenants

This configuration file should be delivered to Kodjin FHIR server services that support the multi-tenancy option. Kodjin's infrastructure configuration is pre-configured to deliver this configuration to services using a common configuration for all services - globals.yaml.gotmpl

To enable multi-tenancy logic the global configuration file should be used. The global configuration file path is - etc/kodjin/<environment>/globals.yaml.gotmpl

  # Multitenancy environment variables
  multitenancy:
    # Enable multitenancy
    MULTITENANCY_ENABLED: true

In previous versions of Kodjin, multi-tenancy logic was controlled through the multi-tenancy configuration file. That is why multi-tenancy configuration file has a higher priority over the global configuration file. Ensure that the enabled: true setting for multi-tenancy is specified only once.