Refactor check for web config in current dir.

This needs further refactoring.