Artifact 1beb3e9f0e35b947a9c4be7b374fc08f70019708de0358ed9bcacf8f6d8e51ff:
- File www/json-api/api-settings.md — part of check-in [f302b9bc41] at 2023-01-20 00:11:22 on branch json-settings-command — Add docs for /json/settings. (user: stephan size: 2720)
JSON API: /settings
Jump to:
- Fetch Settings
- Set Settings is TODO
Fetch Settings
Status: Implemented 20230120
Required permissions: "o"
Request: /json/settings/get[?version=X]
Response payload example:
{
"access-log":{
"versionable":false,
"sensitive":false,
"defaultValue":"off",
"valueSource":null,
"value":null
},
...
"binary-glob":{
"versionable":true,
"sensitive":false,
"defaultValue":null,
"valueSource":"versioned",
"value":"*.gif\n*.ico\n*.jpg\n*.odp\n*.dia\n*.pdf\n*.png\n*.wav..."
},
...
"web-browser":{
"versionable":false,
"sensitive":true,
"defaultValue":null,
"valueSource":"repo",
"value":"firefox"
}
}
Each key in the payload is the name of a fossil-recognized setting, modeled as an object. The keys of that are:
defaultValue: the setting's default value, ornullif no default is defined.value: The current value of that setting.valueSource: one of ("repo","checkout","versioned", ornull), specifying the data source where the setting was found. The settings sources are checked in this order and the first one found is the result:- If
version=Xis provided, check-inXis searched for a versionable-settings file. If found, its value is used andvalueSourcewill be"versioned". IfXis not a checkin, an error response is produced with codeFOSSIL-3006. - If a versionable setting is found in the current checkout, its
value is used and
valueSourcewill be"versioned" - If the setting is found in checkout database's
vvartable, its value is used andvalueSourcewill be"checkout". - If the setting is found in repository's
configtable, its value is used andvalueSourcewill be"repo". - If no value is found,
nullis used for both thevalueandvalueSourceresults. Note that global settings are never checked because they can leak information which have nothing specifically to do with the given repository.
- If
sensitive: a value which fossil has flagged as sensitive can only be fetched by a Setup user. For other users, they will always have avalueandvalueSourceofnull.versionable:trueif the setting is tagged as versionable, elsefalse.
Note that settings are internally stored as strings, even if they're semantically treated as numbers. The way settings are stored and handled does not give us enough information to recognize their exact data type here so they are passed on as-is.