Move testnet setting to config.edn

* use config.edn/environment for on-testnet instead of system property
  to make deployment simpler
This commit is contained in:
Teemu Patja 2017-06-01 14:24:55 +03:00
parent 9486c382f9
commit 57f136bdb3
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
2 changed files with 5 additions and 6 deletions

View File

@ -7,7 +7,6 @@
[repos :as repos]
[issues :as issues]]
[ring.util.codec :as codec]
[commiteth.config :refer [env]]
[clj-http.client :as http]
[commiteth.config :refer [env]]
[digest :refer [sha-256]]
@ -17,7 +16,6 @@
(:import [java.util UUID]))
(def ^:dynamic url "https://api.github.com/")
(defonce ^:const on-testnet? (System/getProperty "commiteth.onTestnet"))
(defn server-address [] (:server-address env))
(defn client-id [] (:github-client-id env))
(defn client-secret [] (:github-client-secret env))
@ -25,6 +23,7 @@
(defn hook-secret [] (:github-hook-secret env))
(defn self [] (:github-user env))
(defn self-password [] (:github-password env))
(defn on-testnet? [] (env :on-testnet))
(defn authorize-url [scope]
(let [params (codec/form-encode {:client_id (client-id)
@ -184,7 +183,7 @@
(md-image "Contract deploying" (str (server-address) "/img/deploying_contract.png")))
(defn network-text []
(str "Network: " (if on-testnet?
(str "Network: " (if (on-testnet?)
"Testnet"
"Mainnet")
"\n"))

View File

@ -5,10 +5,10 @@
[ring.util.response :refer [redirect]]
[ring.util.http-response :refer [ok header]]
[clojure.tools.logging :as log]
[clojure.java.io :as io]))
[clojure.java.io :as io]
[commiteth.config :refer [env]]))
(defonce ^:const version (System/getProperty "commiteth.version"))
(defonce ^:const on-testnet? (System/getProperty "commiteth.onTestnet"))
(defn home-page [{user-id :id
login :login
@ -21,7 +21,7 @@
:authorize-url (github/signup-authorize-url)
:authorize-url-admin (github/admin-authorize-url)
:commiteth-version version
:on-testnet? on-testnet?}))
:on-testnet? (env :on-testnet)}))
(defroutes home-routes
(GET "/" {{user :identity} :session}