Merge branch 'main' into rm-env-id

This commit is contained in:
Max Peintner
2025-02-24 16:57:25 +01:00
committed by GitHub
7 changed files with 28 additions and 43 deletions

View File

@@ -1,2 +1,2 @@
*
!docker
/*
!/docker

View File

@@ -58,13 +58,14 @@ jobs:
run: pnpm install
- name: Build for Docker
run: NEXT_PUBLIC_BASE_PATH=/new-login pnpm build:docker
run: NEXT_PUBLIC_BASE_PATH=/ui/v2/login pnpm build:docker
- name: Build and Push Image
id: build
uses: docker/build-push-action@v5
timeout-minutes: 10
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}

View File

@@ -66,17 +66,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
- name: Setup Cypress binary cache
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-binary-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cypress-binary-
# The Cypress binary cache needs to be updated together with the pnpm dependencies cache.
# That's why we don't conditionally cache it using if: ${{ matrix.command == 'test:integration' }}
- name: Install Dependencies
run: pnpm install --frozen-lockfile

View File

@@ -14,14 +14,6 @@ declare namespace NodeJS {
*/
ZITADEL_API_URL: string;
/**
* Takes effect only if ZITADEL_API_URL is not empty.
* This is only relevant if Zitadels runtime has the ZITADEL_INSTANCEHOSTHEADERS config changed.
* The default is x-zitadel-instance-host.
* Most users don't need to set this variable.
*/
ZITADEL_INSTANCE_HOST_HEADER: string;
/**
* Self hosting: The service user token
*/
@@ -31,5 +23,11 @@ declare namespace NodeJS {
* Optional: wheter a user must have verified email
*/
EMAIL_VERIFICATION: string;
/**
* Optional: custom request headers to be added to every request
* Split by comma, key value pairs separated by colon
*/
CUSTOM_REQUEST_HEADERS: string;
}
}

View File

@@ -42,26 +42,23 @@ export async function createServiceForHost<T extends ServiceClass>(
throw new Error("No token found");
}
const instanceHost = new URL(serviceUrl).host;
const transport = createServerTransport(token, {
baseUrl: process.env.ZITADEL_API_URL ?? serviceUrl,
interceptors:
(process.env.ZITADEL_API_URL &&
process.env.ZITADEL_API_URL != serviceUrl) ||
process.env.ZITADEL_INSTANCE_HOST_HEADER
? [
(next) => {
return (req) => {
req.header.set(
process.env.ZITADEL_INSTANCE_HOST_HEADER ??
"x-zitadel-instance-host",
instanceHost,
);
return next(req);
};
},
]
: undefined,
baseUrl: serviceUrl,
interceptors: !process.env.CUSTOM_REQUEST_HEADERS
? undefined
: [
(next) => {
return (req) => {
process.env.CUSTOM_REQUEST_HEADERS.split(",").forEach(
(header) => {
const kv = header.split(":");
req.header.set(kv[0], kv[1]);
},
);
return next(req);
};
},
],
});
return createClientFor<T>(service)(transport);

View File

@@ -5,7 +5,7 @@
"scripts": {
"generate": "turbo run generate",
"build": "turbo run build",
"build:docker": "rm -rf ./out ./docker && mkdir -p ./docker && turbo run build --filter=./packages/zitadel-client && turbo prune @zitadel/login --docker && cd ./docker && cp -r ../out/json/* . && pnpm install --frozen-lockfile && cp -r ../out/full/* . && turbo run build:standalone && cd ..",
"build:docker": "rm -rf ./out ./docker && turbo run build --filter=./packages/zitadel-client && turbo prune @zitadel/login --docker && mkdir -p ./docker && cd ./docker && cp -r ../out/json/* . && pnpm install --frozen-lockfile && cp -r ../out/full/* . && turbo run build:standalone && cd ..",
"build:packages": "turbo run build --filter=./packages/*",
"build:apps": "turbo run build --filter=./apps/*",
"test": "turbo run test",

View File

@@ -12,7 +12,7 @@
"ZITADEL_API_URL",
"ZITADEL_SERVICE_USER_TOKEN",
"NEXT_PUBLIC_BASE_PATH",
"ZITADEL_INSTANCE_HOST_HEADER"
"CUSTOM_REQUEST_HEADERS"
],
"tasks": {
"generate": {