move credential reading into their own function and test it