Pushing all file reading and environment access to certificate.rb

This way every other file should be easier to test.
Should also make configuration a lot nicer to test.