diff --git a/core/core.lisp b/core/core.lisp index 5805680..5de430c 100644 --- a/core/core.lisp +++ b/core/core.lisp @@ -4,7 +4,7 @@ (:use :common-lisp) (:local-nicknames (:config :scopes/config) (:message :scopes/core/message)) - (:export #:root-config #:add-config #:add-action + (:export #:root-config #:service-config #:add-config #:add-action #:default-setup #:setup-services #:context #:*root* #:find-service #:config #:name #:send #:printer)) diff --git a/test/test-web.lisp b/test/test-web.lisp index 47f654b..fff153b 100644 --- a/test/test-web.lisp +++ b/test/test-web.lisp @@ -19,19 +19,20 @@ (*config* nil) (server:*listener* nil)) (load (t:test-path "config-web" "etc")) + (core:setup-services *config*) (let ((cfg (cadr (config:children *config*)))) - (test-server-config cfg) - (server:start cfg)) + (test-server-config cfg)) (sleep 0.1) - (let ((cfg (car (config:children *config*)))) - (test-client cfg)) + (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-client (cfg) - (== (client:url cfg) "http://localhost:8899") - (== (dexador:get (client:url cfg)) "Hello World!")) +(t:deftest test-client () + (let ((cfg (core:config (core:find-service :client)))) + (== (client:url cfg) "http://localhost:8899") + (== (dexador:get (client:url cfg)) "Hello World!"))) diff --git a/web/client.lisp b/web/client.lisp index d7c29ba..ea4fc14 100644 --- a/web/client.lisp +++ b/web/client.lisp @@ -2,11 +2,12 @@ (defpackage :scopes/web/client (:use :common-lisp) - (:local-nicknames (:config :scopes/config)) + (:local-nicknames (:config :scopes/config) + (:core :scopes/core)) (:export #:config #:url)) (in-package :scopes/web/client) -(defclass config (config:base) +(defclass config (core:service-config) ((url :reader url :initarg :url :initform "http://localhost:8899"))) diff --git a/web/server.lisp b/web/server.lisp index 1d089e2..6f160b9 100644 --- a/web/server.lisp +++ b/web/server.lisp @@ -2,13 +2,14 @@ (defpackage :scopes/web/server (:use :common-lisp) - (:local-nicknames (:config :scopes/config)) + (:local-nicknames (:config :scopes/config) + (:core :scopes/core)) (:export #:config #:address #:port #:*listener* #:start #:stop)) (in-package :scopes/web/server) -(defclass config (config:base) +(defclass config (core:service-config) ((config:env-slots :initform '(address port)) (address :reader address :initarg :address :initform "localhost") (port :reader port :initarg :port :initform "8888")))