Update config/constants.php with defined() checks

Allows for easier override with an environment-based configs.

Close #4045
3 files changed