mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fixes
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
9374789a71
commit
5514e98b1d
@ -27,7 +27,17 @@ import { isClusterPageContext } from "../utils/cluster-id-url-parsing";
|
|||||||
let apiBase: JsonApi;
|
let apiBase: JsonApi;
|
||||||
let apiKube: KubeJsonApi;
|
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({
|
apiBase = new JsonApi({
|
||||||
serverAddress: `http://127.0.0.1:${window.location.port}`,
|
serverAddress: `http://127.0.0.1:${window.location.port}`,
|
||||||
apiBase: apiPrefix,
|
apiBase: apiPrefix,
|
||||||
@ -37,7 +47,9 @@ if (isClusterPageContext()) {
|
|||||||
"Host": window.location.host
|
"Host": window.location.host
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isClusterPageContext()) {
|
||||||
apiKube = new KubeJsonApi({
|
apiKube = new KubeJsonApi({
|
||||||
serverAddress: `http://127.0.0.1:${window.location.port}`,
|
serverAddress: `http://127.0.0.1:${window.location.port}`,
|
||||||
apiBase: apiKubePrefix,
|
apiBase: apiKubePrefix,
|
||||||
|
|||||||
@ -192,7 +192,6 @@ export class JsonApi<D = JsonApiData, P extends JsonApiParams = JsonApiParams> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected writeLog(log: JsonApiLog) {
|
protected writeLog(log: JsonApiLog) {
|
||||||
if (!this.config.debug) return;
|
|
||||||
const { method, reqUrl, ...params } = log;
|
const { method, reqUrl, ...params } = log;
|
||||||
|
|
||||||
logger.info(`[JSON-API] request ${method} ${reqUrl}`, params);
|
logger.info(`[JSON-API] request ${method} ${reqUrl}`, params);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user