Write to settings.php from api

Tags: #<Tag:0x00007f880ed41668>
(Emrys Roberts) #1

I recently added an endpoint /admin/loglevel.json that directly edits the $log_level option in settings.php. (line highlighted above)

This only works if the settings.php file is given write access to the apache user (www-data). This would enable a user to increase or decrease the number of emoncms log entries without having to access the settings file directly via a terminal or file browser. This would not have been easily done on the old emonpi as the file systems was read only by default.

Could this be a stupid move?? :thinking: If anybody can see issues with directly writing to the settings.php from the api please let me know.

This could be extended to set the other default settings in default.settings.php from the api and create a method to allow users to fill in any of the values within the web application. (eg. an install wizard.)

This ties into with other discussions regarding managing the settings file:-

(Brian Orpin) #2


There was some discussion about not having writeable files in the www folder somewhere.