simplify context logic, use regex for matching env var