This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates for tenant system, make cloud tenants optional and add local …
…tenant configuration
- Loading branch information
Showing
10 changed files
with
65 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default defineAppConfig({ | ||
enableCloudTenants: false, | ||
localTenant: { | ||
name : "walt.id GmbH", | ||
logoImage : "/svg/waltid.svg", | ||
inWalletLogoImage : "/svg/walt-s.svg", | ||
bgImage : "/images/start-page-background.png", | ||
showWaltidLoadingSpinner : true, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
export function useTenant() { | ||
return useState("tenant-config", async () => { | ||
const baseTenantDomain = useRequestURL().host.replace(":3000", ":8080"); | ||
console.log("Base tenant domain is: ", baseTenantDomain) | ||
console.log("Getting tenant config..."); | ||
const config = useAppConfig(); | ||
console.log("App config: ", config); | ||
|
||
const { data , error } = await useFetch("http://" + baseTenantDomain + "/config/wallet"); | ||
console.log("Tenant configuration: ", data.value) | ||
if (config.enableCloudTenants) { | ||
const baseTenantDomain = useRequestURL().host.replace(":3000", ":8080"); | ||
console.log("Base tenant domain is: ", baseTenantDomain); | ||
|
||
if (error.value) { | ||
console.log("Tenant error: ", error.value.message) | ||
throw createError({ | ||
statusCode: 404, | ||
statusMessage: "Tenant error: " + error.value?.data?.message, | ||
fatal: true | ||
}) | ||
} | ||
const { data, error } = await useFetch("http://" + baseTenantDomain + "/config/wallet"); | ||
console.log("Tenant configuration: ", data.value); | ||
|
||
if (error.value) { | ||
const dataMessage = error.value?.data?.message; | ||
const localErrorMessage = error.value?.message; | ||
|
||
console.log("Tenant error, error message: ", dataMessage); | ||
console.log("Tenant error, data message: ", dataMessage); | ||
|
||
return data.value; | ||
const errorMessage = dataMessage ? dataMessage : localErrorMessage; | ||
|
||
throw createError({ | ||
statusCode: 404, | ||
statusMessage: "Tenant error: " + errorMessage, | ||
fatal: true | ||
}); | ||
} | ||
|
||
return data.value; | ||
} else { | ||
return config.localTenant; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.