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.
66 lines
1.8 KiB
66 lines
1.8 KiB
(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 |
|
#:testp |
|
#:database-name)) |
|
(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 |
|
`(:application-root ,(asdf:component-pathname (asdf:find-system :ritherdon-archive)))) |
|
|
|
(defconfig |development| |
|
`(:debug T |
|
:databases |
|
((:maindb :sqlite3 |
|
:database-name ,(merge-pathnames #P"db/nera-dev.db" |
|
*application-root*))))) |
|
|
|
(defconfig |production| |
|
`(:debug nil |
|
:databases |
|
((:maindb :sqlite3 |
|
:database-name ,(merge-pathnames #P"db/nera-prod.db" |
|
*application-root*))))) |
|
|
|
(defconfig |staging| |
|
`(:debug T |
|
,@|production|)) |
|
|
|
(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")) |
|
|
|
(defun stagingp () |
|
(string= (appenv) "staging")) |
|
|
|
(defun database-name () |
|
(first (last (first (config :databases))))) |
|
|
|
;;; Use this to change the environment between "development" and |
|
;;; "production". This change is mostly to specifiy which database the |
|
;;; system will use. |
|
(setf (osicat:environment-variable "APP_ENV") "development")
|
|
|