34 lines
962 B
Common Lisp
34 lines
962 B
Common Lisp
;;;; cl-scopes/config
|
|
|
|
;;;; Utilities for configuration of scopes services.
|
|
|
|
(defpackage :scopes/config
|
|
(:use :common-lisp)
|
|
(:export #:base
|
|
#:override-keys #:env-prefix #:env-path))
|
|
|
|
(in-package :scopes/config)
|
|
|
|
(defclass base ()
|
|
((override-keys :reader override-keys
|
|
:initform nil
|
|
:allocation :class)
|
|
(env-prefix :reader env-prefix
|
|
:initarg :env-prefix
|
|
:initform "SCOPES_")
|
|
(env-path :reader env-path
|
|
:initarg :env-path
|
|
:initform nil)))
|
|
|
|
(defmethod initialize-instance :after ((cfg base) &key &allow-other-keys)
|
|
(let* ((prefix (env-prefix cfg))
|
|
(ep (env-path cfg))
|
|
(dotenv-data (if ep (dotenv:read-env ep))))
|
|
(print prefix)
|
|
(dolist (sl (override-keys cfg))
|
|
(let ((key (concatenate 'string prefix (string sl))))
|
|
(format t "~%key: ~s " key)))))
|
|
|
|
|
|
;(defun dummy (cfg)
|
|
; (uiop:getenv key))
|