The idea is that an application has users. This is the meeting spot for all ECM application and system pieces that (hopefully) cover the needs. Backwards compatible!
In general all users are, well, users. So the supertype of user, which is not a superuser but a superclass as it were, is outlined Here
The idea is to keep it all in one place.
The config for the old version, and therefore our version, is stored
in ~/.ecm/json
.
(import :std/text/json)
(export #t)
(def conf #f)
(def (update-conf (fname "~/.ecm/ecm.json"))
(set! conf (call-with-input-file fname read-json)))
(def (conf-value key (conf conf) reload: (r? #f))
(def rest [])
(when (list? key) (set! rest (cdr key)) (set! key (car key)))
(when (or (not conf) r?) (update-conf))
(let ((res (hash-ref conf key (void))))
(if (and (not (null? rest)) (hash-table? res))
(conf-value rest res)
res)))
There are many ways in which the interaction with the database is driven by users and it matters to the database!
Because of that there’s a lot dedicated.
;; -*- Gerbil -*-
(import :std/build-script)
(defbuild-script
'("login/conf"
"login/database"
"login/types"
"login/api"
"login/handler"
"login/reset-password"
(exe: "login")
"user/database/interface"
"user/database/pool"
"user/database"
"user/entity"
))
(package: ecm
;; depend: ("github.com/drewc/ftw")
)
(begin
(import :ecm/login/handler
:ecm/login/conf
:ecm/login/reset-password
:ecm/login/database :std/net/httpd :std/contract :std/net/httpd/mux)
(import
:std/pregexp :std/net/smtp :std/net/httpd/mux :std/net/httpd :std/net/uri
:std/contract :std/text/json :std/misc/ports :std/text/utf8
:ecm/login/database :ecm/login/handler)
(update-conf) (create-reset-token "me+ecm@drewc.ca"))
(def server (run-login-server "0.0.0.0:8080"))