2020-12-14 19:31:48 +01:00
|
|
|
const CouchDB = require("../../db")
|
2021-05-11 18:49:26 +02:00
|
|
|
const { getDeployedApps } = require("../../utilities/workerRequests")
|
|
|
|
const { getScopedConfig } = require("@budibase/auth").db
|
|
|
|
const { Configs } = require("@budibase/auth").constants
|
|
|
|
const { checkSlashesInUrl } = require("../../utilities")
|
2020-12-14 19:31:48 +01:00
|
|
|
|
2021-05-04 12:32:22 +02:00
|
|
|
exports.fetchUrls = async ctx => {
|
2021-05-11 18:49:26 +02: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-14 19:31:48 +01:00
|
|
|
ctx.body = {
|
2021-05-11 18:49:26 +02:00
|
|
|
app: appUrl,
|
2020-12-14 19:31:48 +01:00
|
|
|
}
|
|
|
|
}
|
2021-01-14 18:01:31 +01:00
|
|
|
|
2021-05-04 12:32:22 +02:00
|
|
|
exports.getDeployedApps = async ctx => {
|
2021-04-09 16:11:49 +02:00
|
|
|
ctx.body = await getDeployedApps(ctx)
|
2021-01-14 18:01:31 +01:00
|
|
|
}
|