diff --git a/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts b/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts index 2be3053c..41fe8ddd 100644 --- a/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +++ b/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts @@ -314,7 +314,8 @@ export async function generateResourcesForMainTheme(params: { } const { extractedDirPath } = await downloadAndExtractArchive({ - urlOrPath: "https://repo1.maven.org/maven2/org/keycloak/keycloak-account-ui/25.0.1/keycloak-account-ui-25.0.1.jar", + urlOrPath: + "https://repo1.maven.org/maven2/org/keycloak/keycloak-account-ui/25.0.1/keycloak-account-ui-25.0.1.jar", cacheDirPath: buildContext.cacheDirPath, fetchOptions: buildContext.fetchOptions, uniqueIdOfOnArchiveFile: "bring_in_account_v3_i18n_messages", diff --git a/src/bin/start-keycloak/start-keycloak.ts b/src/bin/start-keycloak/start-keycloak.ts index 63ed9a52..db3edd66 100644 --- a/src/bin/start-keycloak/start-keycloak.ts +++ b/src/bin/start-keycloak/start-keycloak.ts @@ -431,6 +431,18 @@ export async function command(params: { cliCommandOptions: CliCommandOptions }) const srcDirPath = pathJoin(buildContext.projectDirPath, "src"); { + const kcHttpRelativePath = (() => { + const match = buildContext.startKeycloakOptions.dockerExtraArgs + .join(" ") + .match(/KC_HTTP_RELATIVE_PATH=([^ ]+)/); + + if (match === null) { + return undefined; + } + + return match[1]; + })(); + const handler = async (data: Buffer) => { if (!data.toString("utf8").includes("Listening on: http://0.0.0.0:8080")) { return; @@ -448,7 +460,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions }) )} are mounted in the Keycloak container.`, "", `Keycloak Admin console: ${chalk.cyan.bold( - `http://localhost:${port}` + `http://localhost:${port}${kcHttpRelativePath ?? ""}` )}`, `- user: ${chalk.cyan.bold("admin")}`, `- password: ${chalk.cyan.bold("admin")}`, @@ -456,7 +468,21 @@ export async function command(params: { cliCommandOptions: CliCommandOptions }) "", `${chalk.green("Your theme is accessible at:")}`, `${chalk.green("➜")} ${chalk.cyan.bold( - `https://my-theme.keycloakify.dev${port === DEFAULT_PORT ? "" : `?port=${port}`}` + (() => { + const url = new URL("https://my-theme.keycloakify.dev"); + + if (port !== DEFAULT_PORT) { + url.searchParams.set("port", `${port}`); + } + if (kcHttpRelativePath !== undefined) { + url.searchParams.set( + "kcHttpRelativePath", + kcHttpRelativePath + ); + } + + return url.href; + })() )}`, "", "You can login with the following credentials:", diff --git a/src/bin/tools/downloadAndExtractArchive.ts b/src/bin/tools/downloadAndExtractArchive.ts index f46fe397..3a1e1f00 100644 --- a/src/bin/tools/downloadAndExtractArchive.ts +++ b/src/bin/tools/downloadAndExtractArchive.ts @@ -21,7 +21,7 @@ export async function downloadAndExtractArchive(params: { }) => Promise; cacheDirPath: string; fetchOptions: FetchOptions | undefined; -}): Promise<{ extractedDirPath: string; archiveFilePath: string; }> { +}): Promise<{ extractedDirPath: string; archiveFilePath: string }> { const { urlOrPath, uniqueIdOfOnArchiveFile,