Detect the Current Environment