annotate src/private/tools/config_save.txt.luan @ 12:3e2cb946d511

form handling
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 30 Oct 2023 14:59:45 -0600
parents 43814e9f5802
children 552d6f944acb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local stringify = Luan.stringify or error()
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Io = require "luan:Io.luan"
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Http = require "luan:http/Http.luan"
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Config = require "site:/lib/Config.luan"
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 return function()
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local config = Http.request.parameters.config or error()
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 Config.set(config)
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 Io.stdout = Http.response.text_writer()
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 %>saved<%
43814e9f5802 add config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 end