comparison src/lib/Shared.luan @ 1:b116b6ef07bf

add config
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 23 Oct 2024 21:18:04 -0600
parents fddd11ae516c
children ee1f91e67509
comparison
equal deleted inserted replaced
0:fddd11ae516c 1:b116b6ef07bf
1 local Luan = require "luan:Luan.luan" 1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error 2 local error = Luan.error
3 local ipairs = Luan.ipairs or error() 3 local ipairs = Luan.ipairs or error()
4 local parse = Luan.parse or error()
5 local Io = require "luan:Io.luan"
6 local uri = Io.uri or error()
4 7
5 8
6 local Shared = {} 9 local Shared = {}
7 10
8 function Shared.head() 11 function Shared.head()
31 [[<a href="/private/">private</a>]] 34 [[<a href="/private/">private</a>]]
32 [[<a href="/private/tools/">tools</a>]] 35 [[<a href="/private/tools/">tools</a>]]
33 } 36 }
34 end 37 end
35 38
39 local config_file = uri("site:/private/local/config.luano")
40 Shared.config_file = config_file
41
42 do
43 if config_file.exists() then
44 Shared.config = parse( config_file.read_text() )
45 else
46 Shared.config = {
47 mail_server = {
48 host = "smtpcorp.com"
49 port = 465
50 username = "xxx"
51 password = "xxx"
52 }
53 }
54 end
55 end
56
36 return Shared 57 return Shared