Updating API endpoints, to include the new system one, updating hosting envoy yaml to cover these.

This commit is contained in:
mike12345567 2021-08-02 12:09:03 +01:00
parent 10bb31afd2
commit f6d0db4c4b
10 changed files with 39 additions and 23 deletions

View File

@ -26,6 +26,14 @@ static_resources:
cluster: couchdb-service cluster: couchdb-service
prefix_rewrite: "/" prefix_rewrite: "/"
- match: { prefix: "/api/system/" }
route:
cluster: worker-dev
- match: { prefix: "/api/admin/" }
route:
cluster: worker-dev
- match: { prefix: "/api/global/" } - match: { prefix: "/api/global/" }
route: route:
cluster: worker-dev cluster: worker-dev

View File

@ -37,11 +37,19 @@ static_resources:
route: route:
cluster: app-service cluster: app-service
# special case for worker admin API # special cases for worker admin (deprecated), global and system API
- match: { prefix: "/api/global/" } - match: { prefix: "/api/global/" }
route: route:
cluster: worker-service cluster: worker-service
- match: { prefix: "/api/admin/" }
route:
cluster: worker-service
- match: { prefix: "/api/system/" }
route:
cluster: worker-service
- match: { path: "/" } - match: { path: "/" }
route: route:
cluster: app-service cluster: app-service

View File

@ -41,7 +41,7 @@ export function createAdminStore() {
async function multiTenancyEnabled() { async function multiTenancyEnabled() {
let enabled = false let enabled = false
try { try {
const response = await api.get(`/api/global/flags`) const response = await api.get(`/api/system/flags`)
const json = await response.json() const json = await response.json()
enabled = json.multiTenancy enabled = json.multiTenancy
} catch (err) { } catch (err) {

View File

@ -1,8 +0,0 @@
const Router = require("@koa/router")
const controller = require("../../controllers/global/flags")
const router = Router()
router.get("/api/global/flags", controller.fetch)
module.exports = router

View File

@ -1,11 +0,0 @@
const Router = require("@koa/router")
const controller = require("../../controllers/global/tenants")
const adminOnly = require("../../../middleware/adminOnly")
const router = Router()
router
.get("/api/global/tenants/:tenantId/exists", controller.exists)
.get("/api/global/tenants", adminOnly, controller.fetch)
module.exports = router

View File

@ -2,12 +2,12 @@ const userRoutes = require("./global/users")
const configRoutes = require("./global/configs") const configRoutes = require("./global/configs")
const workspaceRoutes = require("./global/workspaces") const workspaceRoutes = require("./global/workspaces")
const templateRoutes = require("./global/templates") const templateRoutes = require("./global/templates")
const tenantsRoutes = require("./global/tenants")
const emailRoutes = require("./global/email") const emailRoutes = require("./global/email")
const authRoutes = require("./global/auth") const authRoutes = require("./global/auth")
const roleRoutes = require("./global/roles") const roleRoutes = require("./global/roles")
const sessionRoutes = require("./global/sessions") const sessionRoutes = require("./global/sessions")
const flagRoutes = require("./global/flags") const flagRoutes = require("./system/flags")
const tenantsRoutes = require("./system/tenants")
const appRoutes = require("./app") const appRoutes = require("./app")
exports.routes = [ exports.routes = [

View File

@ -0,0 +1,8 @@
const Router = require("@koa/router")
const controller = require("../../controllers/system/flags")
const router = Router()
router.get("/api/system/flags", controller.fetch)
module.exports = router

View File

@ -0,0 +1,11 @@
const Router = require("@koa/router")
const controller = require("../../controllers/system/tenants")
const adminOnly = require("../../../middleware/adminOnly")
const router = Router()
router
.get("/api/system/tenants/:tenantId/exists", controller.exists)
.get("/api/system/tenants", adminOnly, controller.fetch)
module.exports = router