title: SBT: How to access environment variable or configuration?
body: <p>I publish to an internal Nexus repository. We have two repos, "dev" and "production". Developers use the dev repo, the build team uses the production repo which they access from machines in a secure area. I would like to add an environment variable or SBT config that defines STAGE with a default value of "dev". On the production build boxes STAGE would be overriden to "production". How can I do this? I am able to define stage in my build.sbt file and use it in the publishTo task, I just can't figure out how to get the value from the environment. Here is what I have.</p>
  
  <pre><code>val stage = settingKey[String]("stage") 
  
  stage := "dev"
  
  publishTo &lt;&lt;= (version, stage) { (v: String, s: String) =&gt;
    val nexus = "http://my-internal-nexus:8081/nexus/content/repositories/"
    if (v.trim.endsWith("SNAPSHOT"))
      Some("snapshots" at nexus + s + "-snapshots-m2")
    else
      Some("releases"  at nexus + s + "-releases-m2")
  }
  </code></pre>