From e25f64da7112b88e10e7bfd63ff7ef3de74e8fdf Mon Sep 17 00:00:00 2001
From: mike12345567
Date: Wed, 6 Jan 2021 10:59:10 +0000
Subject: [PATCH] Fixing up settings to only take the one URL now, the main
hosting URL.
---
.../start/BuilderSettingsModal.svelte | 5 +--
.../server/src/utilities/builder/hosting.js | 31 +++++++++----------
2 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/packages/builder/src/components/start/BuilderSettingsModal.svelte b/packages/builder/src/components/start/BuilderSettingsModal.svelte
index 302b385af8..6ddad0c787 100644
--- a/packages/builder/src/components/start/BuilderSettingsModal.svelte
+++ b/packages/builder/src/components/start/BuilderSettingsModal.svelte
@@ -42,10 +42,7 @@
{#if selfhosted}
-
-
-
-
+
{/if}
diff --git a/packages/server/src/utilities/builder/hosting.js b/packages/server/src/utilities/builder/hosting.js
index 0e5e07b26f..f7a3528733 100644
--- a/packages/server/src/utilities/builder/hosting.js
+++ b/packages/server/src/utilities/builder/hosting.js
@@ -5,6 +5,14 @@ function getProtocol(hostingInfo) {
return hostingInfo.useHttps ? "https://" : "http://"
}
+async function getURLWithPath(pathIfSelfHosted) {
+ const hostingInfo = await exports.getHostingInfo()
+ const protocol = getProtocol(hostingInfo)
+ const path =
+ hostingInfo.type === exports.HostingTypes.SELF ? pathIfSelfHosted : ""
+ return `${protocol}${hostingInfo.hostingUrl}${path}`
+}
+
exports.HostingTypes = {
CLOUD: "cloud",
SELF: "self",
@@ -22,10 +30,7 @@ exports.getHostingInfo = async () => {
doc = {
_id: HOSTING_DOC,
type: exports.HostingTypes.CLOUD,
- appUrl: "app.budi.live",
- workerUrl: "",
- minioUrl: "",
- couchUrl: "",
+ hostingUrl: "app.budi.live",
templatesUrl: "prod-budi-templates.s3-eu-west-1.amazonaws.com",
useHttps: true,
}
@@ -37,30 +42,24 @@ exports.getAppUrl = async appId => {
const hostingInfo = await exports.getHostingInfo()
const protocol = getProtocol(hostingInfo)
let url
- if (hostingInfo.type === "cloud") {
- url = `${protocol}${appId}.${hostingInfo.appUrl}`
+ if (hostingInfo.type === exports.HostingTypes.CLOUD) {
+ url = `${protocol}${appId}.${hostingInfo.hostingUrl}`
} else {
- url = `${protocol}${hostingInfo.appUrl}`
+ url = `${protocol}${hostingInfo.hostingUrl}/app`
}
return url
}
exports.getWorkerUrl = async () => {
- const hostingInfo = await exports.getHostingInfo()
- const protocol = getProtocol(hostingInfo)
- return `${protocol}${hostingInfo.workerUrl}`
+ return getURLWithPath("/worker")
}
exports.getMinioUrl = async () => {
- const hostingInfo = await exports.getHostingInfo()
- const protocol = getProtocol(hostingInfo)
- return `${protocol}${hostingInfo.minioUrl}`
+ return getURLWithPath("/")
}
exports.getCouchUrl = async () => {
- const hostingInfo = await exports.getHostingInfo()
- const protocol = getProtocol(hostingInfo)
- return `${protocol}${hostingInfo.couchUrl}`
+ return getURLWithPath("/db")
}
exports.getTemplatesUrl = async (appId, type, name) => {