Add support for multiple endpoints and basedirs per endpoint