diff --git a/package.json b/package.json index 32a66bc..ec6a88e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipwhitelist", - "version": "0.5.148", + "version": "0.5.149", "description": "IP WhiteList microservice for cloud provider", "main": "server.js", "scripts": { diff --git a/v2/server.js b/v2/server.js index ee142bd..6ede9c5 100644 --- a/v2/server.js +++ b/v2/server.js @@ -69,7 +69,7 @@ function createV2Router() { const token = req.session && req.session.token; if (!token) return res.send('

Нет токена

Войти

'); try { - const raw = await iamFetch(token, 'https://auth-api-test.ngcloud.ru/api/v1/auth/user'); + const raw = await iamFetch(token, config.iamApiBase + '/auth/user'); res.set('Content-Type', 'text/html; charset=utf-8'); res.send(rawPage('IAM TEST', raw)); } catch (e) { @@ -82,7 +82,7 @@ function createV2Router() { const token = req.session && req.session.token; if (!token) return res.send('

Нет токена

Войти

'); try { - const raw = await iamFetch(token, 'https://auth-api-dev.ngcloud.ru/api/v1/auth/user'); + const raw = await iamFetch(token, config.iamApiBase + '/auth/user'); res.set('Content-Type', 'text/html; charset=utf-8'); res.send(rawPage('IAM DEV', raw)); } catch (e) { @@ -95,10 +95,11 @@ function createV2Router() { const token = req.session && req.session.token; if (!token) return res.send('

Нет токена

Войти

'); + const base = config.iamApiBase; const tests = [ { name: 'auth-api /auth/user', - url: 'https://auth-api.ngcloud.ru/api/v1/auth/user', + url: base + '/auth/user', }, { name: 'lk-api-gateway /iam/auth/user', @@ -106,7 +107,7 @@ function createV2Router() { }, { name: 'auth-api /impersonation/status', - url: 'https://auth-api.ngcloud.ru/api/v1/impersonation/status', + url: base + '/impersonation/status', }, ]; diff --git a/v2/src/config/index.js b/v2/src/config/index.js index ae7a0d5..eb8800f 100644 --- a/v2/src/config/index.js +++ b/v2/src/config/index.js @@ -13,6 +13,7 @@ module.exports = { // ── IAM ────────────────────────────────────────────────────────────────── iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user', + iamApiBase: process.env.IAM_API_BASE || 'https://auth-api.ngcloud.ru/api/v1', // ── OIDC (Keycloak) ────────────────────────────────────────────────────── kcBaseUrl: process.env.V2_KC_BASE_URL || 'https://italo.kube5s.ru:8080/realms/ipwhitelist',