ashwanthkumar / gocd-janitor

Attempt at a more intelligent GoCD purge policy
16 stars 11 forks source link

NOJIRA : Ability to use environment and system properties in config #8

Closed tootedom closed 8 years ago

tootedom commented 8 years ago

Hi there,

TLDR; Allow the use of environment variable or system properties within the .config file.

There might be another way to do this, as my experience with the type space config isn't too great, but I couldn't figure out any other way.

I wish to be able to pull the GOCD username and password from the environment, rather than committing the username and password into the configuration file. For example:

gocd.janitor {
  server = "http://localhost:8153"
  username = ${GOCD_USERNAME}
  password = ${GOCD_PASSWORD}
  ....

The username and password for gocd can than be sourced at runtime. This could extend to other values in the configuration too. However, for our purposes, the username and password is the require fields to be sourced from the environment.

The pull request has the environment taking precedence over system properties (i.e. operator override).

Hope that makes sense. Thanks /dom

ashwanthkumar commented 8 years ago

Thanks :+1: