Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 28 additions and 17 deletions.
  1. +1 −1 Procfile
  2. +23 −14 src/cloauth/server.clj
  3. +4 −2 src/gitauth/gitkit.clj
View
2 Procfile
@@ -1 +1 @@
-web: lein run -m cloauth.server
+web: lein run
View
37 src/cloauth/server.clj
@@ -10,29 +10,38 @@
:user "cloauth"
:password "password"})))
-(def db-params {:classname "org.postgresql.Driver"
- :subprotocol "postgresql"
- :subname "//localhost:5432/cloauth"
- :user "cloauth"
- :password "password"})
-
+
+
+(def db-params
+ (merge {:classname "org.postgresql.Driver"
+ :subprotocol "postgresql"}
+ (if-let [url (System/getenv "DATABASE_URL")]
+ {:subname url}
+ ; else
+ {:user "cloauth"
+ :subname "//localhost:5432/cloauth"
+ :password "password"})))
+
+
(defdb db db-params)
- (comment {:classname "org.postgresql.Driver"
- :user "cloauth"
- :password "password"
- :subprotocol "postgresql"
- :subname (get (System/getenv) "DATABASE_URL" "//localhost:5432/cloauth")})
+
+(println "Db defined " db)
+
(server/load-views "src/cloauth/views/")
+(def port (or
+ (if-let [p (System/getenv "PORT")]
+ (Integer/parseInt p)
+ 8080)))
(defn -main [& m]
- (let [mode (keyword (or (first m) :dev))
- port (Integer. (get (System/getenv) "PORT" "8080"))]
+ (let [mode (keyword (or (first m) :dev))]
+ (println "Starting on " port)
(server/start port {:mode mode
:ns 'cloauth})))
; For dev - start server on load
-(-main)
+;(-main)
View
6 src/gitauth/gitkit.clj
@@ -6,8 +6,10 @@
[clj-json.core :as json]))
-; Get our google API key stored on disk
-(def apikey (slurp "api-key"))
+; Get our google API key stored on disk or in an environment var
+(def apikey
+ (or (System/getenv "GOOGLE_API_KEY")
+ (slurp "api-key")))
;; Google Git parameters for this app
;; You can figure these out by going to your google api console and having it generate

No commit comments for this range

Something went wrong with that request. Please try again.