add detecting env snippet