view src/private/tools/save_config.txt.luan @ 54:1d724f187cff

minor fix
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 03 Mar 2025 21:19:12 -0700
parents b116b6ef07bf
children e229f4aacde0
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 uri = Io.uri or error()
local Http = require "luan:http/Http.luan"
local Shared = require "site:/lib/Shared.luan"
local config_file = Shared.config_file or error()


return function()
	local config = Http.request.parameters.config or error()
	config = parse(config)
	uri("site:/private/local/").mkdir()
	config_file.write_text(stringify(config).."\n")
	Http.reset_luan()
	Io.stdout = Http.response.text_writer()
	%>saved<%
end