add dotenv so that it works locally

also add safe_set so that config problems are exposed earlier