From f935f05509e438d647efab080326dcc3eff270f8 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Wed, 14 Dec 2022 21:48:48 +0000 Subject: [PATCH] Offline license POC (#9046) --- packages/backend-core/src/environment.ts | 1 - .../backend-core/tests/utilities/mocks/licenses.ts | 14 +++++++------- packages/server/src/environment.ts | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index 2377c8ceba..00d8c3fa9e 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -71,7 +71,6 @@ const environment = { PLUGIN_BUCKET_NAME: process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS, USE_COUCH: process.env.USE_COUCH || true, - DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE, DEFAULT_LICENSE: process.env.DEFAULT_LICENSE, SERVICE: process.env.SERVICE || "budibase", LOG_LEVEL: process.env.LOG_LEVEL, diff --git a/packages/backend-core/tests/utilities/mocks/licenses.ts b/packages/backend-core/tests/utilities/mocks/licenses.ts index 0ef5eedb73..1fbda5655e 100644 --- a/packages/backend-core/tests/utilities/mocks/licenses.ts +++ b/packages/backend-core/tests/utilities/mocks/licenses.ts @@ -2,14 +2,14 @@ import { Feature, License, Quotas } from "@budibase/types" import _ from "lodash" let CLOUD_FREE_LICENSE: License -let TEST_LICENSE: License +let UNLIMITED_LICENSE: License let getCachedLicense: any // init for the packages other than pro export function init(proPkg: any) { initInternal({ CLOUD_FREE_LICENSE: proPkg.constants.licenses.CLOUD_FREE_LICENSE, - TEST_LICENSE: proPkg.constants.licenses.DEVELOPER_FREE_LICENSE, + UNLIMITED_LICENSE: proPkg.constants.licenses.UNLIMITED_LICENSE, getCachedLicense: proPkg.licensing.cache.getCachedLicense, }) } @@ -17,11 +17,11 @@ export function init(proPkg: any) { // init for the pro package export function initInternal(opts: { CLOUD_FREE_LICENSE: License - TEST_LICENSE: License + UNLIMITED_LICENSE: License getCachedLicense: any }) { CLOUD_FREE_LICENSE = opts.CLOUD_FREE_LICENSE - TEST_LICENSE = opts.TEST_LICENSE + UNLIMITED_LICENSE = opts.UNLIMITED_LICENSE getCachedLicense = opts.getCachedLicense } @@ -48,7 +48,7 @@ export const useLicense = (license: License, opts?: UseLicenseOpts) => { } export const useUnlimited = (opts?: UseLicenseOpts) => { - return useLicense(TEST_LICENSE, opts) + return useLicense(UNLIMITED_LICENSE, opts) } export const useCloudFree = () => { @@ -58,7 +58,7 @@ export const useCloudFree = () => { // FEATURES const useFeature = (feature: Feature) => { - const license = _.cloneDeep(TEST_LICENSE) + const license = _.cloneDeep(UNLIMITED_LICENSE) const opts: UseLicenseOpts = { features: [feature], } @@ -77,7 +77,7 @@ export const useGroups = () => { // QUOTAS export const setAutomationLogsQuota = (value: number) => { - const license = _.cloneDeep(TEST_LICENSE) + const license = _.cloneDeep(UNLIMITED_LICENSE) license.quotas.constant.automationLogRetentionDays.value = value return useLicense(license) } diff --git a/packages/server/src/environment.ts b/packages/server/src/environment.ts index bf5330f9b6..e7418ba5ec 100644 --- a/packages/server/src/environment.ts +++ b/packages/server/src/environment.ts @@ -79,7 +79,6 @@ const environment = { // flags ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS, DISABLE_THREADING: process.env.DISABLE_THREADING, - DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE, DISABLE_AUTOMATION_LOGS: process.env.DISABLE_AUTOMATION_LOGS, MULTI_TENANCY: process.env.MULTI_TENANCY, ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,