shadow: fix and improve config path detection