;; (in-package :cl-user) (defpackage hot-line.config (:use :cl) (:import-from :envy :config-env-var :defconfig) (:export :config :*application-root* :*static-directory* :*template-directory* :appenv :developmentp :productionp)) (in-package :hot-line.config) (setf (config-env-var) "APP_ENV") (defparameter *application-root* (asdf:system-source-directory :hot-line)) (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 :hot-line)) :databases ((:maindb :sqlite3 :database-name ,(merge-pathnames #P"db/hot-line.db"))))) (defconfig |development| '()) (defconfig |production| `(:debug nil :databases ((:maindb :sqlite3 :database-name ,(merge-pathnames #P"db/hot-line.db" *application-root*))))) (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")) ;;; 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")