1
0
Fork 0
mirror of synced 2024-08-15 18:11:40 +12:00

gate env vars in binding drawers behind license

This commit is contained in:
Peter Clement 2023-01-26 15:09:20 +00:00
parent 843649eb54
commit debef20af5
4 changed files with 24 additions and 20 deletions

View file

@ -21,7 +21,7 @@ import {
import { TableNames } from "../constants"
import { JSONUtils } from "@budibase/frontend-core"
import ActionDefinitions from "components/design/settings/controls/ButtonActionEditor/manifest.json"
import { environment } from "stores/portal"
import { environment, licensing } from "stores/portal"
// Regex to match all instances of template strings
const CAPTURE_VAR_INSIDE_TEMPLATE = /{{([^}]+)}}/g
@ -54,8 +54,13 @@ export const getBindableProperties = (asset, componentId) => {
* Gets all rest bindable data fields
*/
export const getRestBindings = () => {
const hasEnvironmentVariablesEnabled = get(licensing).hasEnvironmentVariables
const userBindings = getUserBindings()
return [...userBindings, ...getAuthBindings(), ...getEnvironmentBindings()]
return [
...userBindings,
...getAuthBindings(),
...(hasEnvironmentVariablesEnabled ? getEnvironmentBindings() : []),
]
}
/**

View file

@ -18,7 +18,7 @@
import { automationStore } from "builderStore"
import { tables } from "stores/backend"
import { environment } from "stores/portal"
import { environment, licensing } from "stores/portal"
import WebhookDisplay from "../Shared/WebhookDisplay.svelte"
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
@ -169,21 +169,22 @@
}
// Environment bindings
bindings = bindings.concat(
$environment.variables.map(variable => {
return {
label: `env.${variable.name}`,
path: `env.${variable.name}`,
type: "test",
icon: "Key",
category: "Environment",
display: {
type: "string",
name: variable.name,
},
}
})
)
if ($licensing.environmentVariablesEnabled) {
bindings = bindings.concat(
$environment.variables.map(variable => {
return {
label: `env.${variable.name}`,
path: `env.${variable.name}`,
icon: "Key",
category: "Environment",
display: {
type: "string",
name: variable.name,
},
}
})
)
}
return bindings
}

View file

@ -28,7 +28,6 @@
$: readableValue = runtimeToReadableBinding(bindings, value)
$: tempValue = readableValue
$: console.log(tempValue)
$: isJS = isJSBinding(value)
const saveBinding = () => {

View file

@ -64,7 +64,6 @@ export const createLicensingStore = () => {
Constants.Features.ENVIRONMENT_VARIABLES
)
environmentVariablesEnabled = true
store.update(state => {
return {
...state,