Get debug setting from os env.
Refactor.