environment variables ui boilerplate

This commit is contained in:
Peter Clement 2023-01-09 16:48:39 +00:00
parent 30e90b2d5d
commit 7378d21fea
3 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,39 @@
<script>
import {
Layout,
Heading,
Body,
Button,
Select,
Divider,
Modal,
Search,
} from "@budibase/bbui"
import { onMount } from "svelte"
onMount(async () => {
await envVars.load()
})
</script>
<Layout noPadding>
<Layout gap="XS" noPadding>
<Heading size="M">Envrironment Variables</Heading>
<Body
>Add and manage environment variable for development and production</Body
>
</Layout>
<Divider size="S" />
<Layout noPadding>
{#each $envVars as envVar}
<Layout gap="XS" noPadding>
<Heading size="S">{envVar}</Heading>
</Layout>
<Divider size="S" />
{/each}
</Layout>
</Layout>
<style>
</style>

View File

@ -0,0 +1,20 @@
import { writable } from "svelte/store"
import { API } from "api"
export function createEnvVarsStore() {
const { subscribe, set, update } = writable([])
async function load() {
const envVars = await API.fetchEnvVars()
let testVars = ['blah', 'blah123']
set(testVars)
}
return {
subscribe,
load,
}
}
export const envVars = createEnvVarsStore()

View File

@ -0,0 +1,11 @@
export const buildEnvironmentVariableEndpoints = API => ({
/**
* Fetches a list of environment variables
*/
fetchEnvVars: async () => {
return await API.get({
url: `/api/env/variables`,
json: false,
})
}
})