2

I am trying to set production and dev profiles in Eclipse in order to deploy my compojure/ring app on Heroku. However, the Counterclockwise plug-in doesn't load up environment variables from the profile. I have added the variables in the environment tab and have restarted the REPL but the variables are still not available. This is how I added them: environment variables.

I have also tried adding the variables to profiles.clj but to no avail:

`:profiles
    {:production
      {:ring
        {:open-browser? false, 
         :stacktraces? false, 
         :auto-reload? false}
       :env {:port 3000
           :db-url "//localhost/login"
           :db-user "test"
           :db-pass "test"
           :galleries-path "test"}}
       :dev
        {:dependencies [[ring-mock "0.1.5"]
                        [ring/ring-devel "1.2.0"]]
        :env {:port 3000
              :db-url "//localhost/gallery"
              :db-user "test"
              :db-pass "testProd"
              :galleries-path "galleries"}}}`

1 Answers1

0

When you use environ, it automatically coerces "DB_URL" into the more idiomatic :db-url. Looking at environ's coercion code, it doesn't seem like it should matter, but I would try uppercasing and underscoring all of the environment variables you have set in the Environment tab.

Daniel Compton
  • 13,878
  • 4
  • 40
  • 60
  • After making the suggested edits, I am getting the following error: `db-spec {:password nil, :subprotocol "postgresql", :user nil, :subname nil} is missing a required parameter` Here is my db-spec: `(def db {:subprotocol "postgresql" :subname (env :db-url) :user (env :db-user) :password (env :db-pass)})` I just don't know what the required parameter is. – Nasko Apostolov May 05 '16 at 02:10
  • Probably the nil values are the missing ones? – Daniel Compton May 05 '16 at 08:39
  • You are correct. However, the problem is not that the nil values are missing but that they are not evaluated properly which comes back to your point about how environ coerces environment variables. After the suggested changes, my db-spec looks like this: `(def db {:subprotocol "postgresql" :subname (env :DB_URL) :user (env :DB_USER) :password (env :DB_PASS)})` When I run `db`, I get the following result: `=> db {:subprotocol "postgresql", :subname nil, :user nil, :password nil}` – Nasko Apostolov May 07 '16 at 01:53