[luci] Where to put parameters for a LuCI application

Jo-Philipp Wich xm at subsignal.org
Thu Aug 14 22:45:23 CEST 2014


On 14.08.2014 22:06, Christian Schoenebeck wrote:
> Hi,
> 
> I'm currently working on rewriting ddns-scripts including a new luci-app-ddns.
> I want to use some uci parameters to show different information inside luci app depending on these settings.
> i.e. show time of last update or to show time until next update.

That sounds like something you do not want to store in /etc/config/ -
that would imply a flash write whenever there's some DDNS update, same
for any other kind of runtime information.

You can use luci.model.uci.cursor_state() to instantiate an uci context
that refers to /var/state/ which resides in the ramdisk.

Any :set() operation will write into /var/state/configname, any :get()
operation first parses /var/state/configname, then
/etc/config/configname, this way non-persistent values are overlayed
over the static configuration files.

~ Jow


More information about the luci mailing list