Configuration Parameters
MARS configuration is a name/value store (TMARSParameters) available at the engine and application levels. Values are typically loaded from an .ini file next to the executable with FEngine.Parameters.LoadFromIniFile, and can be read in code or injected with [EngineParam] / [ApplicationParam].
[Engine]
Port=8080
ThreadPoolSize=75
BasePath=/rest
[DefaultApp]
JWT.Secret=please-change-me
JWT.Duration=1When AddApplication runs, the engine copies the matching .ini section (by application name) into the application's parameters.
Engine parameters
| Parameter | Type | Default | Purpose |
|---|---|---|---|
Port | Integer | 8080 | HTTP listening port. |
PortSSL | Integer | 0 | HTTPS port (0 = disabled). |
ThreadPoolSize | Integer | 75 | Worker threads (size for concurrent requests, incl. open SSE streams). |
BasePath | string | /rest | Root path stripped from every URL before application matching. |
CORS-related parameters (when CORS is enabled) include CORS.Origin, CORS.Methods, CORS.Headers. See Engine ▸ CORS.
JWT / authentication parameters (per application)
Read by the token resource and JWT backends:
| Parameter | Default | Purpose |
|---|---|---|
JWT.Secret | (a fixed GUID — change it!) | HMAC signing secret. |
JWT.Issuer | MARS-Curiosity | iss claim. |
JWT.Duration | 1 | Token lifetime in days. |
JWT.Duration.InMinutes | — | Lifetime in minutes (alternative). |
JWT.Duration.InSeconds | — | Lifetime in seconds (alternative). |
JWT.CookieEnabled | true | Also deliver/accept the token as a cookie. |
JWT.CookieName | access_token | Cookie name. |
JWT.CookieDomain | — | Cookie domain. |
JWT.CookiePath | — | Cookie path. |
JWT.CookieSecure | false | Mark the cookie Secure (HTTPS only). |
Change JWT.Secret
The default secret ships in the public source. Always set a strong, unique secret per deployment.
FireDAC parameters
Connection definitions live under a slice (commonly FireDAC) and are loaded with TMARSFireDAC.LoadConnectionDefs(FEngine.Parameters, 'FireDAC'). Each named definition maps to a FireDAC ConnectionDefName with its usual driver-specific keys (DriverID, Database, Server, User_Name, Password, pooling options, …). See FireDAC & Datasets.
Reading and injecting parameters
// In code
var LPort := FEngine.Parameters.ByName('Port').AsInteger;
var LSecret := LApp.Parameters.ByName('JWT.Secret').AsString;
// Injected into a resource
[Path('cfg')]
TCfgResource = class
[EngineParam('Port', 8080)] Port: Integer;
[ApplicationParam('JWT.Secret')] Secret: string;
end;Provide a default as the second argument to ByName/[EngineParam]/[ApplicationParam] so missing keys degrade gracefully.
Custom parameters
You can add your own keys to the .ini and read/inject them the same way — a convenient place for feature flags, external service URLs, file paths, etc.
[DefaultApp]
Feature.NewSearch=true
Storage.Path=C:\data\uploads[ApplicationParam('Storage.Path')] StoragePath: string;