Dynamic Setting Values

Token Replacement

Engine provides the ability to use some tokens in your setting values that will be replaced at runtime with the appropriate value. Currently, the tokens you can use are ${RegistrationId} and ${TenantName}.

If you wanted to use a registration's ID as part of the value of RedirectOnExitUrl, for example, your setting value could be: http://example.org/lms?registrationId=${RegistrationId}. That way, your redirect page would receive the registration id of the current launch at runtime.

Alternatively, you may use the ${TenantName} token for settings which you want to vary by tenant, but the only difference is the tenant name. For example, you could keep each tenant's content under a different path:

<add key="WebPathToContentRoot" value="/courses/${TenantName}">
<add key="FilePathToContentRoot" value="C:\inetpub\wwwroot\courses\${TenantName}"/>

Note: If you use the ${TenantName} token in any settings that govern file paths, make sure that the tenant name you pass into Engine follows the same capitalization standards every time you use it. Engine trusts the tenant name that you specify, and will it in token replacement even if the tenant name is capitalized differently than previously recorded. When Engine compares file paths, it has to do so case-sensitively to support case-sensitive file systems. This pattern can cause negative affects, even when running on applications that use case-insensitive file paths.

Environment Variables

We support the use of environment variables as another option for token replacement. For example, if all of your environments save their course content to different directories on the same network drive, you could set your FilePathToContentRoot to //network-drive/server-content/${env:CONTENT_FOLDER_NAME}/ and, assuming every web server has an environment variable CONTENT_FOLDER_NAME set to the appropriate value, each instance of Engine will save its course content to their own separate directories.

Special Tenant Syntax

Many configuration settings can be specified on a per-tenant basis. When getting a tenant-specific configuration setting, Engine will check for the setting prefixed by the lower-case tenant name and a dot. If found, the value of that entry will be used; if not, the value of the non-prefixed setting will be used.

For example, your LMS might have 5 tenants: AcmeCo, BusinessPlus, MaximumProfit, MoneyCorp, and SolutionsInc. If the first three use connection string database=a;password=secret; and the last two use connection string database=b;password=secret, then you can include the following two entries in your configuration file:

<add key="DataPersistenceEngine" value="sqlserver"/>
<add key="SystemDatabaseConnectionString" value="database=system;password=secret;"/>
<add key="TenantDatabaseConnectionString" value="database=a;password=secret;"/>
<add key="moneycorp.TenantDatabaseConnectionString" value="database=b;password=secret;"/>
<add key="solutionsinc.TenantDatabaseConnectionString" value="database=b;password=secret;"/>

These examples use the .NET configuration file format, but the principle still holds for Java-style configuration.

results matching ""

    No results matching ""