mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Bring back try-catch for initGlobalFeatureSet
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import * as Sentry from '@sentry/node';
|
||||||
import NodeCache from 'node-cache';
|
import NodeCache from 'node-cache';
|
||||||
import {
|
import {
|
||||||
getLicenseKey,
|
getLicenseKey,
|
||||||
@@ -97,29 +98,35 @@ class EELicenseService {
|
|||||||
const licenseServerKey = await getLicenseServerKey();
|
const licenseServerKey = await getLicenseServerKey();
|
||||||
const licenseKey = await getLicenseKey();
|
const licenseKey = await getLicenseKey();
|
||||||
|
|
||||||
if (licenseServerKey) {
|
try {
|
||||||
// license server key is present -> validate it
|
if (licenseServerKey) {
|
||||||
const token = await refreshLicenseServerKeyToken()
|
// license server key is present -> validate it
|
||||||
|
const token = await refreshLicenseServerKeyToken()
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
this.instanceType = 'cloud';
|
||||||
|
}
|
||||||
|
|
||||||
if (token) {
|
return;
|
||||||
this.instanceType = 'cloud';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
if (licenseKey) {
|
||||||
}
|
// license key is present -> validate it
|
||||||
|
const token = await refreshLicenseKeyToken();
|
||||||
if (licenseKey) {
|
|
||||||
// license key is present -> validate it
|
if (token) {
|
||||||
const token = await refreshLicenseKeyToken();
|
const { data: { currentPlan } } = await licenseKeyRequest.get(
|
||||||
|
`${await getLicenseServerUrl()}/api/license/v1/plan`
|
||||||
if (token) {
|
);
|
||||||
const { data: { currentPlan } } = await licenseKeyRequest.get(
|
|
||||||
`${await getLicenseServerUrl()}/api/license/v1/plan`
|
this.globalFeatureSet = currentPlan;
|
||||||
);
|
this.instanceType = 'enterprise-self-hosted';
|
||||||
|
}
|
||||||
this.globalFeatureSet = currentPlan;
|
|
||||||
this.instanceType = 'enterprise-self-hosted';
|
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// case: self-hosted free
|
||||||
|
Sentry.setUser(null);
|
||||||
|
Sentry.captureException(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user