App settings file doesn't get updated

  1. Add the following code in app_settings.json
"replication_depth": [
            "role": "supervisor",
            "depth": "2"
  1. Run compile-app-settings and upload-app-settings commands.

  2. Now remove the code and re-do step 2.

  3. Download the app_settings.json file from the UI while logged in as an admin and you will see that the replication code still exists.

What the output of cht-conf? Does it log any errors? Are there any errors logged by api?

I think this is the default behavior.

Suppose, you upload app-settings with a single property:

  "locale": "en"

Now if you download the current settings, you will see that everything is still there.

In order to remove the replication_depth setting for all roles, you can upload it as an empty array:

"replication_depth": []

Please note that trying to upload an empty settings file {} might not work because cht-conf would not detect any changes. Also, make sure to change the property slightly so that the change is detected. For example, "locale": "en" to "locale": "fr".


If you want to dive deeper into its working mechanism, there are two resources:

  1. cht-conf code: updateAppSettings
  2. CHT API documentation: PUT /api/v1/settings

Here, you can see that cht-conf uses the API:

const updateAppSettings = (settings) => {
  return request({
    method: 'PUT',
    url: `${environment.apiUrl}/_design/medic/_rewrite/update_settings/medic?replace=1`,
    headers: {'Content-Type': 'application/json'},
    body: settings,

When uploading the settings, cht-conf sets replace=1 but leaves the overwrite parameter. So, it replaces the individual settings (such as replication_depth) but it does not overwrite the whole settings.

If it had set overwrite=1, whole settings would have been overwritten (although the permissions setting is still spared).

We can test all this by hitting the CHT API using tools such as curl or Postman.


No errors @derick. @binod’s solution worked.