Simplify logic around custom environment variables