1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00

Offline license POC (#9046)

This commit is contained in:
Rory Powell 2022-12-14 21:48:48 +00:00 committed by GitHub
parent 2215c9eab2
commit f935f05509
3 changed files with 7 additions and 9 deletions

View file

@ -71,7 +71,6 @@ const environment = {
PLUGIN_BUCKET_NAME: PLUGIN_BUCKET_NAME:
process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS, process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS,
USE_COUCH: process.env.USE_COUCH || true, USE_COUCH: process.env.USE_COUCH || true,
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE, DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
SERVICE: process.env.SERVICE || "budibase", SERVICE: process.env.SERVICE || "budibase",
LOG_LEVEL: process.env.LOG_LEVEL, LOG_LEVEL: process.env.LOG_LEVEL,

View file

@ -2,14 +2,14 @@ import { Feature, License, Quotas } from "@budibase/types"
import _ from "lodash" import _ from "lodash"
let CLOUD_FREE_LICENSE: License let CLOUD_FREE_LICENSE: License
let TEST_LICENSE: License let UNLIMITED_LICENSE: License
let getCachedLicense: any let getCachedLicense: any
// init for the packages other than pro // init for the packages other than pro
export function init(proPkg: any) { export function init(proPkg: any) {
initInternal({ initInternal({
CLOUD_FREE_LICENSE: proPkg.constants.licenses.CLOUD_FREE_LICENSE, 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, getCachedLicense: proPkg.licensing.cache.getCachedLicense,
}) })
} }
@ -17,11 +17,11 @@ export function init(proPkg: any) {
// init for the pro package // init for the pro package
export function initInternal(opts: { export function initInternal(opts: {
CLOUD_FREE_LICENSE: License CLOUD_FREE_LICENSE: License
TEST_LICENSE: License UNLIMITED_LICENSE: License
getCachedLicense: any getCachedLicense: any
}) { }) {
CLOUD_FREE_LICENSE = opts.CLOUD_FREE_LICENSE CLOUD_FREE_LICENSE = opts.CLOUD_FREE_LICENSE
TEST_LICENSE = opts.TEST_LICENSE UNLIMITED_LICENSE = opts.UNLIMITED_LICENSE
getCachedLicense = opts.getCachedLicense getCachedLicense = opts.getCachedLicense
} }
@ -48,7 +48,7 @@ export const useLicense = (license: License, opts?: UseLicenseOpts) => {
} }
export const useUnlimited = (opts?: UseLicenseOpts) => { export const useUnlimited = (opts?: UseLicenseOpts) => {
return useLicense(TEST_LICENSE, opts) return useLicense(UNLIMITED_LICENSE, opts)
} }
export const useCloudFree = () => { export const useCloudFree = () => {
@ -58,7 +58,7 @@ export const useCloudFree = () => {
// FEATURES // FEATURES
const useFeature = (feature: Feature) => { const useFeature = (feature: Feature) => {
const license = _.cloneDeep(TEST_LICENSE) const license = _.cloneDeep(UNLIMITED_LICENSE)
const opts: UseLicenseOpts = { const opts: UseLicenseOpts = {
features: [feature], features: [feature],
} }
@ -77,7 +77,7 @@ export const useGroups = () => {
// QUOTAS // QUOTAS
export const setAutomationLogsQuota = (value: number) => { export const setAutomationLogsQuota = (value: number) => {
const license = _.cloneDeep(TEST_LICENSE) const license = _.cloneDeep(UNLIMITED_LICENSE)
license.quotas.constant.automationLogRetentionDays.value = value license.quotas.constant.automationLogRetentionDays.value = value
return useLicense(license) return useLicense(license)
} }

View file

@ -79,7 +79,6 @@ const environment = {
// flags // flags
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS, ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
DISABLE_THREADING: process.env.DISABLE_THREADING, DISABLE_THREADING: process.env.DISABLE_THREADING,
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
DISABLE_AUTOMATION_LOGS: process.env.DISABLE_AUTOMATION_LOGS, DISABLE_AUTOMATION_LOGS: process.env.DISABLE_AUTOMATION_LOGS,
MULTI_TENANCY: process.env.MULTI_TENANCY, MULTI_TENANCY: process.env.MULTI_TENANCY,
ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS, ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,