Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed issue with file paths at load time.

  • Loading branch information...
commit 266e2b22e01fdddd239bc41534b2fb5b9e9e5c35 1 parent 9c2c996
Josh Marchán authored
Showing with 6 additions and 5 deletions.
  1. +0 −2  README.md
  2. +6 −3 shortening.lisp
View
2  README.md
@@ -86,8 +86,6 @@ your machines.
* If you run this on localhost, you can have some fun with your hosts file. I added 'lch' as a local
hostname, so I can access shortening using <http://lch:8181/ShRTuRL>.
* There's an rc.shortening script that can be used with Arch Linux to daemonize the shortener.
-* If you run it as a daemon, but start it as a user with a ~/.shortening.conf file, that file will
- be used as the configuration, instead of /etc/shortening.conf.
# License
View
9 shortening.lisp
@@ -9,10 +9,13 @@
(defparameter *url-length* 6)
(defvar *external-db* nil)
-(defparameter *config-locations* (list (merge-pathnames ".shortening.conf" (user-homedir-pathname))
- #P"/etc/shortening.conf"))
+(defun config-location ()
+ (find-if #'probe-file
+ (list (merge-pathnames ".shortening.conf" (user-homedir-pathname))
+ #P"/etc/shortening.conf")))
+
(defun load-config ()
- (when-let* ((config-path (find-if #'probe-file *config-locations*))
+ (when-let* ((config-path (config-location))
(config (handler-case (read-files (make-config) (list config-path))
(configparser-error ()
(format *error-output*
Please sign in to comment.
Something went wrong with that request. Please try again.