web/server: also using context (sub-) class now

This commit is contained in:
Helmut Merz 2024-06-21 15:58:20 +02:00
parent 5a4797416b
commit 9cf5155c4c
3 changed files with 15 additions and 7 deletions

View file

@ -6,7 +6,7 @@
(let ((cfg (core:add-config *config* :server
:class 'server:config
:setup #'server:start
:setup #'server:setup
:port "8899"))))
(let ((cfg (core:add-config *config* :client

View file

@ -20,17 +20,16 @@
(server:*listener* nil))
(load (t:test-path "config-web" "etc"))
(core:setup-services *config*)
(let ((cfg (cadr (config:children *config*))))
(test-server-config cfg))
(test-server-config)
(sleep 0.1)
(test-client)
(sleep 0.1)
(server:stop)
(t:show-result)))
(t:deftest test-server-config (cfg)
;(let ((cfg (core:config (core:find-service :server))))
(== (parse-integer (server:port cfg)) 8899))
(t:deftest test-server-config ()
(let ((cfg (core:config (core:find-service :server))))
(== (parse-integer (server:port cfg)) 8899)))
(t:deftest test-client ()
(let ((cfg (core:config (core:find-service :client))))

View file

@ -5,7 +5,7 @@
(:local-nicknames (:config :scopes/config)
(:core :scopes/core))
(:export #:config #:address #:port
#:*listener* #:start #:stop))
#:*listener* #:setup #:start #:stop))
(in-package :scopes/web/server)
@ -30,3 +30,12 @@
(defun stop ()
(clack:stop *listener*))
;;;; context = service
(defclass context (core:context) ())
(defun setup (cfg)
(prog1
(make-instance 'context :config cfg :name (core:name cfg))
(start cfg)))