aboutsummaryrefslogtreecommitdiffstats
path: root/generate-html.lua
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@alpinelinux.org>2017-12-02 11:41:53 +0000
committerCarlo Landmeter <clandmeter@alpinelinux.org>2017-12-02 11:41:53 +0000
commit871a74bc862f8144ef736f0fed4c65b38c6a93ab (patch)
tree52610cb7eef1c87887d2613de16b57a75b680338 /generate-html.lua
parent36bc4a1e54d0ad5a8e1447d00f65754131f35ada (diff)
downloadalpine-mirror-status-871a74bc862f8144ef736f0fed4c65b38c6a93ab.tar.bz2
alpine-mirror-status-871a74bc862f8144ef736f0fed4c65b38c6a93ab.tar.xz
move configuration to seperate file
Diffstat (limited to 'generate-html.lua')
-rwxr-xr-xgenerate-html.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/generate-html.lua b/generate-html.lua
index 7b4772c..25d4ddd 100755
--- a/generate-html.lua
+++ b/generate-html.lua
@@ -4,10 +4,7 @@ local json = require("cjson")
local inspect = require("inspect")
local lustache = require("lustache")
local utils = require("utils")
-
-local outdir = "_out"
-local mirrors_html = "index.html"
-local mirrors_json = "mirror-status.json"
+local conf = require("config")
function get_branches(indexes)
local res = {}
@@ -150,9 +147,11 @@ function build_tables(indexes)
return res
end
-local indexes = json.decode(utils.read_file(outdir.."/"..mirrors_json))
+local out_json = ("%s/%s"):format(conf.outdir, conf.mirrors_json)
+local indexes = json.decode(utils.read_file(out_json))
local thead = get_branches(indexes)
table.insert(thead, 1, "branch/release")
local view = { lupdate = os.date("%c", indexes.date), mirrors = build_tables(indexes), thead = thead }
local tpl = utils.read_file("index.tpl")
-utils.write_file(outdir.."/"..mirrors_html, lustache:render(tpl, view))
+local out_html = ("%s/%s"):format(conf.outdir, conf.mirrors_html)
+utils.write_file(out_html, lustache:render(tpl, view))