From 1a9088e3e92d596fb4bd506da301e7645d46666d Mon Sep 17 00:00:00 2001 From: winzlieb Date: Wed, 9 Mar 2022 15:38:00 +0100 Subject: [PATCH] provide config for codegen --- frontend/search/config.ts | 11 +++++++++++ frontend/search/public/config.json | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 frontend/search/config.ts create mode 100644 frontend/search/public/config.json diff --git a/frontend/search/config.ts b/frontend/search/config.ts new file mode 100644 index 0000000..c4bbe1c --- /dev/null +++ b/frontend/search/config.ts @@ -0,0 +1,11 @@ +import * as default_config from './public/config.json' + +export let config = default_config /** to infer the types **/ +let config_fetched = false + +export async function fetch_config () { + if(!config_fetched) { + await fetch("/config.json").then(async res => {config = await res.json() + config_fetched = true}) + } +} diff --git a/frontend/search/public/config.json b/frontend/search/public/config.json new file mode 100644 index 0000000..eefb5cb --- /dev/null +++ b/frontend/search/public/config.json @@ -0,0 +1,2 @@ +{"base_url": "http://localhost:3000", + "backend_base_url": "http://localhost:4000"}