jorgeu
jorgeu

Reputation: 689

how to detect execution environment?

I would like to have a pair ofdb-specmaps with my database configuration for development and production.

But I can't find an easy way to detect the current execution environment. Need something like (defn db-spec [] (if (is-dev?) { dev-spec-here } { prod-spec-here })).

Maybe it can detect the current lein profile. No matter how I ask to google. Can't find how.

Upvotes: 1

Views: 338

Answers (2)

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91554

I'm fond of using environment variables for this (which can be set system wide for example in /etc/profile amongst other places). others prefer to pass a -D definition to the JVM

Upvotes: 1

number23_cn
number23_cn

Reputation: 4619

your code is okay, detect it depend your environment, like hostname, IP arrdress, global variable etc.

Upvotes: 0

Related Questions