Skip to content

Commit

Permalink
Fix weird dynamic variable behavior. Use lexical scoping.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmpereira committed Sep 5, 2012
1 parent 523feb3 commit ace654d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/hello-world.lisp
Expand Up @@ -5,13 +5,10 @@
#+ccl (ccl:getenv target)
#+sbcl (sb-posix:getenv target))

;; Database
(defvar *database-url* (heroku-getenv "DATABASE_URL"))

(defun db-params ()
"Heroku database url format is postgres://username:password@host:port/database_name.
TODO: cleanup code."
(let* ((url (second (cl-ppcre:split "//" *database-url*)))
(let* ((url (second (cl-ppcre:split "//" (heroku-getenv "DATABASE_URL"))))
(user (first (cl-ppcre:split ":" (first (cl-ppcre:split "@" url)))))
(password (second (cl-ppcre:split ":" (first (cl-ppcre:split "@" url)))))
(host (first (cl-ppcre:split ":" (first (cl-ppcre:split "/" (second (cl-ppcre:split "@" url)))))))
Expand Down

0 comments on commit ace654d

Please sign in to comment.