From 7378d21fea565c388759ba4964cfcf58039738b8 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 9 Jan 2023 16:48:39 +0000 Subject: [PATCH] environment variables ui boilerplate --- .../portal/manage/envVars/index.svelte | 39 +++++++++++++++++++ packages/builder/src/stores/portal/envVars.js | 20 ++++++++++ packages/frontend-core/src/api/envVars.js | 11 ++++++ 3 files changed, 70 insertions(+) create mode 100644 packages/builder/src/pages/builder/portal/manage/envVars/index.svelte create mode 100644 packages/builder/src/stores/portal/envVars.js create mode 100644 packages/frontend-core/src/api/envVars.js diff --git a/packages/builder/src/pages/builder/portal/manage/envVars/index.svelte b/packages/builder/src/pages/builder/portal/manage/envVars/index.svelte new file mode 100644 index 0000000000..9fb19fe676 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/envVars/index.svelte @@ -0,0 +1,39 @@ + + + + + Envrironment Variables + Add and manage environment variable for development and production + + + + {#each $envVars as envVar} + + {envVar} + + + {/each} + + + + diff --git a/packages/builder/src/stores/portal/envVars.js b/packages/builder/src/stores/portal/envVars.js new file mode 100644 index 0000000000..9c9880511a --- /dev/null +++ b/packages/builder/src/stores/portal/envVars.js @@ -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() diff --git a/packages/frontend-core/src/api/envVars.js b/packages/frontend-core/src/api/envVars.js new file mode 100644 index 0000000000..5f02a2b889 --- /dev/null +++ b/packages/frontend-core/src/api/envVars.js @@ -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, + }) + } +})