api: add environment variable for enabling debug