Initial commit.
commit
50f09915bc
@ -0,0 +1 @@
|
||||
This is the stub README.txt for the "cl-config" project.
|
@ -0,0 +1,10 @@
|
||||
;;;; cl-config.asd
|
||||
|
||||
(asdf:defsystem #:cl-config
|
||||
:serial t
|
||||
:description "Describe cl-config here"
|
||||
:author "Your Name <your.name@example.com>"
|
||||
:license "Specify license here"
|
||||
:components ((:file "package")
|
||||
(:file "cl-config")))
|
||||
|
@ -0,0 +1,19 @@
|
||||
(in-package #:cl-config)
|
||||
|
||||
(defparameter *settings* (make-hash-table))
|
||||
|
||||
(defparameter *defaults-config-file* "")
|
||||
(defparameter *overrides-config-file* "")
|
||||
|
||||
(defun read-config-file (file)
|
||||
(when (probe-file file)
|
||||
(with-open-file (f file)
|
||||
(dolist (setting (read f))
|
||||
(setf (gethash (car setting) *settings*) (cadr setting))))))
|
||||
|
||||
(defun load-config ()
|
||||
(read-config-file *defaults-config-file*)
|
||||
(read-config-file *overrides-config-file*))
|
||||
|
||||
(defun conf (setting)
|
||||
(gethash setting *settings*))
|
@ -0,0 +1,9 @@
|
||||
;;;; package.lisp
|
||||
|
||||
(defpackage #:cl-config
|
||||
(:use #:cl)
|
||||
(:export #:*defaults-config-file*
|
||||
#:*overrides-config-file*
|
||||
#:load-config
|
||||
#:conf))
|
||||
|
Loading…
Reference in New Issue