diff 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
line wrap: on
line diff
--- a/src/lib/Shared.luan	Wed Oct 23 13:13:07 2024 -0600
+++ b/src/lib/Shared.luan	Wed Oct 23 21:18:04 2024 -0600
@@ -1,6 +1,9 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local ipairs = Luan.ipairs or error()
+local parse = Luan.parse or error()
+local Io = require "luan:Io.luan"
+local uri = Io.uri or error()
 
 
 local Shared = {}
@@ -33,4 +36,22 @@
 	}
 end
 
+local config_file = uri("site:/private/local/config.luano")
+Shared.config_file = config_file
+
+do
+	if config_file.exists() then
+		Shared.config = parse( config_file.read_text() )
+	else
+		Shared.config = {
+			mail_server = {
+				host = "smtpcorp.com"
+				port = 465
+				username = "xxx"
+				password = "xxx"
+			}
+		}
+	end
+end
+
 return Shared