alphagov/whitehall — pull request #1485 by samjsharpe (2014-05-15 15:35:52+00:00)
Title: Remove reliance on FACTER_govuk_platform environment variable

This envvar is set by and for puppet. It has been abused as a global toggle to
do magic stuff in environments. It will be removed from puppet, being replaced
by feature flags for the features which may differ between environments.

Before we can remove it, we need to remove the reliance on it by applications,
of which Whitehall is one. This is my RubyN00b attempt at that ;)

In general:
- If you want to know the domain name an application will be served from, it is
in the GOVUK_APP_DOMAIN environment variable.
- The current value of FACTER_govuk_platform is actually either 'development'
(when on a personal VM) or 'production' (on all of our remote environments).
It is never set to 'preview' or indeed anything else. In fact I think it's
the same as `Rails.env`.

So I have replaced instances of appending 'alphagov.co.uk' to
`ENV['FACTER_govuk_platform']` to derive the domain name with
`ENV['GOVUK_APP_DOMAIN']` and instances of guessing the environment by testing
if FACTER_govuk_platform is 'development' or 'production' by just testing Rails.env

One of the rake tasks (`export.rake`) has warnings all over it about Transition
relying on it so @jamiecobbett or @jennyduckett might want to have a squiz at this.
I don't think `script/unpublished_docs.rb` is currently used by anything important.

This also fixes #1481