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.
Which .ini file is used
LoadFromIniFile (and SaveToIniFile / IniFileExists) accept an explicit file name. Called without one, they resolve it in this order:
- the
-configFileName <path>command-line switch, if present — handy to run the same binary against different configurations (dev, staging, service instances); - otherwise the module name with the extension changed to
.ini—MyServer.exe→MyServer.ini, an ISAPI DLL →<dllname>.ini.
Parameters.GetFileName returns the path that would be used, with the same rules, which is what to log or display when a server starts up with unexpected settings:
if not FEngine.Parameters.IniFileExists then
Writeln('No configuration file at ' + FEngine.Parameters.GetFileName);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 | — | HMAC signing secret. Missing or equal to the public default: see JWT.AllowDefaultSecret. |
JWT.AllowDefaultSecret | false | Knowingly use the public default secret. Otherwise a DEBUG build generates a random per-process secret and a RELEASE build raises (TMARSToken.DefaultSecretPolicy). |
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). |
Set JWT.Secret
The default secret ships in the public source and is never used unless you opt in with JWT.AllowDefaultSecret. Set a strong, unique secret per deployment; MARSCmd writes a random one into the .ini files of every project it creates.
Logging parameters
Read by the request/response loggers (engine section). Each logger is inert until both its unit is in the server's uses clause and its Enabled flag is set.
| Parameter | Type | Default | Purpose |
|---|---|---|---|
JSONLogging.Enabled | Boolean | False | Enable the NDJSON file logger (MARS.Utils.ReqRespLogger.JSON). |
MemoryLogging.Enabled | Boolean | False | Enable the in-memory logger (MARS.Utils.ReqRespLogger.Memory); it retains whole requests and responses in clear text. |
JSONLogging.Folder | string | <exe folder>\logs | Target directory (created if missing). |
JSONLogging.FileName | string | mars-reqresp.log | Base log file name. |
JSONLogging.DailyRotation | Boolean | True | Insert the date before the extension for daily rotation. |
CodeSiteLogging.Enabled | Boolean | False | Enable CodeSite output (MARS.Utils.ReqRespLogger.CodeSite). |
See Request/Response Logging for the log line format and a Grafana Alloy ingestion example.
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;