Mercurial Hosting > chat
view src/private/tools/save_config.txt.luan @ 80:cb2808b8b1ad
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 10 Mar 2025 21:54:46 -0600 |
parents | e229f4aacde0 |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local parse = Luan.parse or error() local stringify = Luan.stringify or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Db = require "site:/lib/Db.luan" local run_in_transaction = Db.run_in_transaction or error() return function() local config = Http.request.parameters.config or error() config = parse(config) run_in_transaction( function() local doc = Db.get_document("type:config") or { type = "config" } doc.config = stringify(config) Db.save(doc) end ) Http.reset_luan() Io.stdout = Http.response.text_writer() %>saved<% end