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?? 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:-
- split / re-structure settings : Introduce a hierarchical settings file structure · Issue #923 · emoncms/emoncms · GitHub
- move location : Move data & settings file to a common location?
- file format Initial comit of hierarchical ini files to replace settings.php by borpin · Pull Request #1010 · emoncms/emoncms · GitHub