Make providers endpoint-agnostic

A provider can now be registered on multiple endpoints (or potentially
moved if needed).
This commit is contained in:
Asher
2020-07-22 14:53:15 -05:00
parent 2819fd51e2
commit e8f6d30055
5 changed files with 40 additions and 29 deletions

View File

@@ -24,7 +24,7 @@ export class ProxyHttpProvider extends HttpProvider {
const port = route.base.replace(/^\//, "")
return {
proxy: {
base: `${this.options.base}/${port}`,
base: `${route.providerBase}/${port}`,
port,
},
}
@@ -35,7 +35,7 @@ export class ProxyHttpProvider extends HttpProvider {
const port = route.base.replace(/^\//, "")
return {
proxy: {
base: `${this.options.base}/${port}`,
base: `${route.providerBase}/${port}`,
port,
},
}

View File

@@ -131,7 +131,7 @@ export class VscodeHttpProvider extends HttpProvider {
if (!this.isRoot(route)) {
throw new HttpError("Not found", HttpCode.NotFound)
} else if (!this.authenticated(request)) {
return { redirect: "/login", query: { to: this.options.base } }
return { redirect: "/login", query: { to: route.providerBase } }
}
try {
return await this.getRoot(request, route)