forked from own-pt/cl-wnbrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
heroku-setup.lisp
37 lines (30 loc) · 1.57 KB
/
heroku-setup.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(in-package :cl-user)
(print ">>> Building system....")
(load (merge-pathnames "cl-wnbrowser.asd" *build-dir*))
(ql:quickload :cl-wnbrowser)
(defun initialize-application ()
(let* ((vcap (yason:parse (heroku-getenv "VCAP_SERVICES")))
(es-services (car (gethash "databases-for-elasticsearch" vcap)))
(https (gethash "https"
(gethash "connection"
(gethash "credentials" es-services))))
(host (car (gethash "hosts" https)))
(hostname (gethash "hostname" host))
(port (gethash "port" host))
(authentication (gethash "authentication" https))
(user (gethash "username" authentication))
(password (gethash "password" authentication)))
(setf clesc::*es-endpoint* (format NIL "https://~a:~a" hostname port)
clesc::*es-authentication* (list user password)))
(let* ((vcap (yason:parse (heroku-getenv "VCAP_APPLICATION")))
(url (car (gethash "application_uris" vcap))))
(setf cl-wnbrowser::*base-url* (format nil "~a" url)))
(let ((root-accounts (split-sequence:split-sequence #\, (heroku-getenv "ROOT_ACCOUNTS")))
(vote-accounts (split-sequence:split-sequence #\, (heroku-getenv "VOTE_ACCOUNTS"))))
(setf cl-wnbrowser::*approve-reject-authorized-accounts* root-accounts
cl-wnbrowser::*vote-authorized-accounts* vote-accounts))
(setf cl-wnbrowser::*basedir* "/home/vcap/app/")
(setf cl-wnbrowser::*github-client-id* (heroku-getenv "GITHUB_CLIENT_ID"))
(setf cl-wnbrowser::*github-client-secret* (heroku-getenv "GITHUB_CLIENT_SECRET"))
(cl-wnbrowser::publish-static-content cl-wnbrowser::*basedir*))
(print ">>> Done building system")