From ecb056b61e401f1207f06530aaa49377b911de4b Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sat, 22 Jun 2024 11:27:28 +0200 Subject: [PATCH] get rid of all config stuff in core --- core/core.lisp | 15 ++------------- test/etc/config-web.lisp | 13 ++++++------- web/client.lisp | 5 +++-- web/server.lisp | 3 ++- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/core/core.lisp b/core/core.lisp index 9d9916b..da5fed7 100644 --- a/core/core.lisp +++ b/core/core.lisp @@ -4,23 +4,12 @@ (:use :common-lisp) (:local-nicknames (:config :scopes/config) (:message :scopes/core/message)) - (:export #:service-config #:add-config #:add-action - #:default-setup #:setup-services - #:context #:*root* #:find-service #:config #:name #:send + (:export #:default-setup #:setup-services + #:context #:add-action #:*root* #:find-service #:config #:name #:send #:printer)) (in-package :scopes/core) -;;;; config - -(defclass service-config (config:base) - ((setup :initform #'default-setup))) - -(defun add-config (parent name &rest params - &key (setup #'default-setup) (class 'service-config) - &allow-other-keys) - (apply #'make-instance class :parent parent :name name :setup setup params)) - ;;;; actions (defclass action-spec () diff --git a/test/etc/config-web.lisp b/test/etc/config-web.lisp index 28040a1..6cf9e56 100644 --- a/test/etc/config-web.lisp +++ b/test/etc/config-web.lisp @@ -4,11 +4,10 @@ (setf *config* (config:root :env-keys '(:address :port))) -(let ((cfg (core:add-config *config* :server - :class 'server:config - :setup #'server:setup - :port "8899")))) +(let ((cfg (config:add *config* :server + :class 'server:config + :port "8899")))) -(let ((cfg (core:add-config *config* :client - :class 'client:config - :base-url "http://localhost:8899")))) +(let ((cfg (config:add *config* :client + :class 'client:config + :base-url "http://localhost:8899")))) diff --git a/web/client.lisp b/web/client.lisp index ef3ec60..0ffc6dc 100644 --- a/web/client.lisp +++ b/web/client.lisp @@ -9,8 +9,9 @@ (in-package :scopes/web/client) -(defclass config (core:service-config) - ((base-url :reader base-url +(defclass config (config:base) + ((config:setup :initform #'core:default-setup) + (base-url :reader base-url :initarg :base-url :initform "http://localhost:8135"))) diff --git a/web/server.lisp b/web/server.lisp index 0ae6d1f..a684c2c 100644 --- a/web/server.lisp +++ b/web/server.lisp @@ -9,8 +9,9 @@ (in-package :scopes/web/server) -(defclass config (core:service-config) +(defclass config (config:base) ((config:env-slots :initform '(address port)) + (config:setup :initform #'setup) (address :reader address :initarg :address :initform "localhost") (port :reader port :initarg :port :initform "8888")))