Public archive for the Return to Ritherdon project.
https://www.nicolaellisandritherdon.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
2 years ago
|
(in-package :cl-user)
|
||
|
(defpackage ritherdon-archive.config
|
||
|
(:use :cl)
|
||
|
(:import-from :envy
|
||
|
:config-env-var
|
||
|
:defconfig)
|
||
|
(:export :config
|
||
|
:*application-root*
|
||
|
:*static-directory*
|
||
|
:*template-directory*
|
||
|
:appenv
|
||
|
:developmentp
|
||
|
:productionp))
|
||
|
(in-package :ritherdon-archive.config)
|
||
|
|
||
|
(setf (config-env-var) "APP_ENV")
|
||
|
|
||
|
(defparameter *application-root* (asdf:system-source-directory :ritherdon-archive))
|
||
|
(defparameter *static-directory* (merge-pathnames #P"static/" *application-root*))
|
||
|
(defparameter *template-directory* (merge-pathnames #P"templates/" *application-root*))
|
||
|
|
||
|
(defconfig :common
|
||
|
`(:databases ((:maindb :sqlite3 :database-name ":memory:"))))
|
||
|
|
||
|
(defconfig |development|
|
||
|
'())
|
||
|
|
||
|
(defconfig |production|
|
||
|
'())
|
||
|
|
||
|
(defconfig |test|
|
||
|
'())
|
||
|
|
||
|
(defun config (&optional key)
|
||
|
(envy:config #.(package-name *package*) key))
|
||
|
|
||
|
(defun appenv ()
|
||
|
(uiop:getenv (config-env-var #.(package-name *package*))))
|
||
|
|
||
|
(defun developmentp ()
|
||
|
(string= (appenv) "development"))
|
||
|
|
||
|
(defun productionp ()
|
||
|
(string= (appenv) "production"))
|