Mercurial Hosting > freedit
view src/lib/Config.luan @ 55:c57b84f461ae
login and registration work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 28 Nov 2022 20:33:47 -0700 |
parents | 94e26bffd4fb |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Db = require "site:/lib/Db.luan" local Config = {} Config.default_text = [[ local Forum = require "site:/lib/Forum.luan" Forum.title = "Your Forum" ]] local doc = Db.get_document("type:config") Config.text = doc and doc.config or Config.default_text function Config.set(text) Db.run_in_transaction( function() local doc = Db.get_document("type:config") or {type="config"} doc.config = text Db.save(doc) end ) end return Config