medic / cht-conf

A command-line interface for configuring Community Health Toolkit applications
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
22 stars 25 forks source link

Removing purge.js file from project config root does not remove the purge settings #642

Open sugat009 opened 2 weeks ago

sugat009 commented 2 weeks ago

Describe the bug The way to add purging to a project is to add a purge.js file to the project config root as per the docs. So, naturally, to remove purging from a project, a user would think that removing purge.js would be the way to do so, but it doesn't work. If you empty the purge.js file, it creates an empty object in the purge key of the settings JSON file but it's not ideal to have an empty object even in the database.

To Reproduce Steps to reproduce the behavior:

  1. Create a purge.js file and add your purge logic
  2. Run the command cht compile-app-settings
  3. Check the app_settings.json file. A new key purge should have been minified created with the content from the purge.js.
  4. Delete or move or rename the purge.js file.
  5. Run the command cht-compile-app-settings
  6. Check the app_settings.json file. The purge key still exists.

Expected behavior When I delete or move or rename the purge.js file from the root of the project config, the settings should also remove the purge key from the JSON file.

Logs If applicable, include the cht-conf output, server logs, and/or browser logs.

Screenshots If applicable, add screenshots to help explain your problem.

Environment

Additional context Add any other context about the problem here. What have you tried? Is there a workaround?