2020-12-15 07:31:48 +13:00
|
|
|
const CouchDB = require("../../db")
|
2021-05-12 04:49:26 +12:00
|
|
|
const { getDeployedApps } = require("../../utilities/workerRequests")
|
|
|
|
const { getScopedConfig } = require("@budibase/auth").db
|
|
|
|
const { Configs } = require("@budibase/auth").constants
|
|
|
|
const { checkSlashesInUrl } = require("../../utilities")
|
2020-12-15 07:31:48 +13:00
|
|
|
|
2021-05-04 22:32:22 +12:00
|
|
|
exports.fetchUrls = async ctx => {
|
2021-05-12 04:49:26 +12:00
|
|
|
const appId = ctx.appId
|
|
|
|
const db = new CouchDB(appId)
|
|
|
|
const settings = await getScopedConfig(db, { type: Configs.SETTINGS })
|
|
|
|
let appUrl = "http://localhost:10000/app"
|
|
|
|
if (settings && settings["platformUrl"]) {
|
|
|
|
appUrl = checkSlashesInUrl(`${settings["platformUrl"]}/app`)
|
|
|
|
}
|
2020-12-15 07:31:48 +13:00
|
|
|
ctx.body = {
|
2021-05-12 04:49:26 +12:00
|
|
|
app: appUrl,
|
2020-12-15 07:31:48 +13:00
|
|
|
}
|
|
|
|
}
|
2021-01-15 06:01:31 +13:00
|
|
|
|
2021-05-04 22:32:22 +12:00
|
|
|
exports.getDeployedApps = async ctx => {
|
2021-04-10 02:11:49 +12:00
|
|
|
ctx.body = await getDeployedApps(ctx)
|
2021-01-15 06:01:31 +13:00
|
|
|
}
|