1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-08-09 18:44:22 +03:00
parent 9374789a71
commit 5514e98b1d
2 changed files with 13 additions and 2 deletions

View File

@ -27,7 +27,17 @@ import { isClusterPageContext } from "../utils/cluster-id-url-parsing";
let apiBase: JsonApi;
let apiKube: KubeJsonApi;
if (isClusterPageContext()) {
if (typeof window === "undefined") {
apiBase = new JsonApi({
serverAddress: `http://127.0.0.1:${process.env.LENS_PROXY_PORT}`,
apiBase: apiPrefix,
debug: isDevelopment || isDebugging,
}, {
headers: {
"Host": `localhost:${process.env.LENS_PROXY_PORT}`
}
});
} else {
apiBase = new JsonApi({
serverAddress: `http://127.0.0.1:${window.location.port}`,
apiBase: apiPrefix,
@ -37,7 +47,9 @@ if (isClusterPageContext()) {
"Host": window.location.host
}
});
}
if (isClusterPageContext()) {
apiKube = new KubeJsonApi({
serverAddress: `http://127.0.0.1:${window.location.port}`,
apiBase: apiKubePrefix,

View File

@ -192,7 +192,6 @@ export class JsonApi<D = JsonApiData, P extends JsonApiParams = JsonApiParams> {
}
protected writeLog(log: JsonApiLog) {
if (!this.config.debug) return;
const { method, reqUrl, ...params } = log;
logger.info(`[JSON-API] request ${method} ${reqUrl}`, params);