Merge pull request #9504 from Budibase/feat/env-vars-fixes

Env vars fixes from testing
This commit is contained in:
Peter Clement 2023-02-01 15:55:21 +00:00 committed by GitHub
commit e4c39fe2e4
4 changed files with 38 additions and 11 deletions

View File

@ -22,6 +22,8 @@
let developmentValue
let useProductionValue = true
const HasSpacesRegex = /[\\"\s]/
const deleteVariable = async name => {
try {
await environment.deleteVariable(name)
@ -47,10 +49,16 @@
</script>
<ModalContent
disabled={HasSpacesRegex.test(name)}
onConfirm={() => saveVariable()}
title={!row ? "Add new environment variable" : "Edit environment variable"}
>
<Input disabled={row} label="Name" bind:value={name} />
<Input
disabled={row}
label="Name"
bind:value={name}
error={HasSpacesRegex.test(name) && "Must not include spaces"}
/>
<div>
<Heading size="XS">Production</Heading>
<Input

View File

@ -1,6 +1,5 @@
<script>
import { ModalContent, Toggle, Body, InlineAlert } from "@budibase/bbui"
import { licensing } from "stores/portal"
export let app
export let published
@ -17,11 +16,9 @@
</script>
<ModalContent {title} {confirmText} onConfirm={exportApp}>
{#if licensing.environmentVariablesEnabled}
<InlineAlert
header="Do not share your budibase application exports publicly as they may contain sensitive information such as database credentials or secret keys."
/>
{/if}
<Body
>Apps can be exported with or without data that is within internal tables -
select this below.</Body

View File

@ -11,15 +11,17 @@
Body,
Icon,
Search,
InlineAlert,
} from "@budibase/bbui"
import Spinner from "components/common/Spinner.svelte"
import CreateAppModal from "components/start/CreateAppModal.svelte"
import AppLimitModal from "components/portal/licensing/AppLimitModal.svelte"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { store, automationStore } from "builderStore"
import { API } from "api"
import { onMount } from "svelte"
import { apps, auth, admin, licensing } from "stores/portal"
import { apps, auth, admin, licensing, environment } from "stores/portal"
import { goto } from "@roxi/routify"
import AppRow from "components/start/AppRow.svelte"
import { AppStatus } from "constants"
@ -35,6 +37,7 @@
let creatingFromTemplate = false
let automationErrors
let accessFilterList = null
let confirmDownloadDialog
$: welcomeHeader = `Welcome ${$auth?.user?.firstName || "back"}`
$: enrichedApps = enrichApps($apps, $auth.user, sortBy)
@ -193,6 +196,7 @@
onMount(async () => {
try {
await environment.loadVariables()
// If the portal is loaded from an external URL with a template param
const initInfo = await auth.getInitInfo()
if (initInfo?.init_template) {
@ -275,7 +279,7 @@
<Icon
name="Download"
hoverable
on:click={initiateAppsExport}
on:click={confirmDownloadDialog.show}
/>
{/if}
<Select
@ -323,6 +327,18 @@
<AppLimitModal bind:this={appLimitModal} />
<ConfirmDialog
bind:this={confirmDownloadDialog}
okText="Continue"
onOk={initiateAppsExport}
warning={false}
title="Download all apps"
>
<InlineAlert
header="Do not share your budibase application exports publicly as they may contain sensitive information such as database credentials or secret keys."
/>
</ConfirmDialog>
<style>
.title {
display: flex;

View File

@ -25,8 +25,14 @@
$: schema = buildSchema(noEncryptionKey)
onMount(async () => {
try {
await environment.checkStatus()
await environment.loadVariables()
} catch (error) {
notifications.error(
`Error loading environment variables: ${error.message}`
)
}
})
const buildSchema = noEncryptionKey => {