Fix epinio standalone

This commit is contained in:
Richard Cox 2022-04-26 15:50:52 +01:00
parent f76a1bc4a7
commit 8dc2f1b665
3 changed files with 22 additions and 11 deletions

View File

@ -59,12 +59,16 @@ export default {
return await ps return await ps
.then((prependPath = opt?.prependPath) => { .then((prependPath = opt?.prependPath) => {
if (isSingleProduct) { if (isSingleProduct) {
if (opt.url.startsWith('/')) {
opt.url = prependPath + opt.url;
} else {
const url = parseUrl(opt.url); const url = parseUrl(opt.url);
if (!url.path.startsWith(prependPath)) { if (!url.path.startsWith(prependPath)) {
url.path = prependPath + url.path; url.path = prependPath + url.path;
opt.url = unParseUrl(url); opt.url = unParseUrl(url);
} }
}
} else { } else {
const currentClusterId = clusterId || rootGetters['clusterId']; const currentClusterId = clusterId || rootGetters['clusterId'];
const currentCluster = rootGetters[`${ EPINIO_MGMT_STORE }/byId`](EPINIO_TYPES.INSTANCE, currentClusterId); const currentCluster = rootGetters[`${ EPINIO_MGMT_STORE }/byId`](EPINIO_TYPES.INSTANCE, currentClusterId);

View File

@ -244,8 +244,9 @@ export default function(dir, _appConfig) {
if ( pl !== STANDARD ) { if ( pl !== STANDARD ) {
console.log(`PL: ${ pl }`); // eslint-disable-line no-console console.log(`PL: ${ pl }`); // eslint-disable-line no-console
} }
const rancherEnv = process.env.RANCHER_ENV || 'web';
console.log(`API: ${ api }`); // eslint-disable-line no-console console.log(`API: '${ api }'. Env: '${ rancherEnv }'`); // eslint-disable-line no-console
const config = { const config = {
dev, dev,
@ -257,9 +258,10 @@ export default function(dir, _appConfig) {
dev, dev,
pl, pl,
perfTest, perfTest,
rancherEnv
}, },
publicRuntimeConfig: { rancherEnv: process.env.RANCHER_ENV || 'web' }, publicRuntimeConfig: { rancherEnv },
buildDir: dev ? '.nuxt' : '.nuxt-prod', buildDir: dev ? '.nuxt' : '.nuxt-prod',
@ -562,6 +564,7 @@ export default function(dir, _appConfig) {
// Proxy: https://github.com/nuxt-community/proxy-module#options // Proxy: https://github.com/nuxt-community/proxy-module#options
proxy: { proxy: {
'/k8s': proxyWsOpts(api), // Straight to a remote cluster (/k8s/clusters/<id>/) '/k8s': proxyWsOpts(api), // Straight to a remote cluster (/k8s/clusters/<id>/)
'/pp': proxyWsOpts(api), // For (epinio) standalone API
'/api': proxyWsOpts(api), // Management k8s API '/api': proxyWsOpts(api), // Management k8s API
'/apis': proxyWsOpts(api), // Management k8s API '/apis': proxyWsOpts(api), // Management k8s API
'/v1': proxyWsOpts(api), // Management Steve API '/v1': proxyWsOpts(api), // Management Steve API

View File

@ -20,9 +20,12 @@ export default {
// FIXME: RC Standalone - Tech Debt move this to steve store get/set prependPath // FIXME: RC Standalone - Tech Debt move this to steve store get/set prependPath
// Cover cases where the steve store isn't actually going out to steve (epinio standalone) // Cover cases where the steve store isn't actually going out to steve (epinio standalone)
const prependPath = process.env.rancherEnv === 'epinio' ? `/pp/v1/epinio/rancher` : ''; const prependPath = this.$config.rancherEnv === 'epinio' ? `/pp/v1/epinio/rancher` : '';
if (prependPath) { if (prependPath) {
if (opt.url.startsWith('/')) {
opt.url = prependPath + opt.url;
} else {
const url = parseUrl(opt.url); const url = parseUrl(opt.url);
if (!url.path.startsWith(prependPath)) { if (!url.path.startsWith(prependPath)) {
@ -30,6 +33,7 @@ export default {
opt.url = unParseUrl(url); opt.url = unParseUrl(url);
} }
} }
}
opt.httpsAgent = new https.Agent({ rejectUnauthorized: false }); opt.httpsAgent = new https.Agent({ rejectUnauthorized: false });