diff --git a/frontend/src/lib/components/InstanceSettings.svelte b/frontend/src/lib/components/InstanceSettings.svelte
index 5e19c3d310..19bcbe198c 100644
--- a/frontend/src/lib/components/InstanceSettings.svelte
+++ b/frontend/src/lib/components/InstanceSettings.svelte
@@ -51,7 +51,12 @@
await Promise.all(
Object.entries(settings).map(
async ([_, y]) =>
- await Promise.all(y.map(async (x) => [x.key, await getValue(x.key, x.storage)]))
+ await Promise.all(
+ y.map(async (x) => [
+ x.key,
+ (await getValue(x.key, x.storage)) ?? x.defaultValue?.()
+ ])
+ )
)
)
).flat()
@@ -452,8 +457,7 @@
{#if hasError}
- Base url must start with http:// or https:// and must NOT end with a
- trailing slash.
+ {setting.error ?? ''}
{/if}
{:else}
diff --git a/frontend/src/lib/components/instanceSettings.ts b/frontend/src/lib/components/instanceSettings.ts
index b21a2619bd..3e1e9fd040 100644
--- a/frontend/src/lib/components/instanceSettings.ts
+++ b/frontend/src/lib/components/instanceSettings.ts
@@ -18,6 +18,8 @@ export interface Setting {
| 'license_key'
storage: SettingStorage
isValid?: (value: any) => boolean
+ error?: string
+ defaultValue?: () => any
}
export type SettingStorage = 'setting' | 'config'
@@ -32,7 +34,8 @@ export const settings: Record = {
placeholder: 'https://windmill.com',
storage: 'setting',
isValid: (value: string | undefined) =>
- value ? value?.startsWith('http') && value.includes('://') && !value?.endsWith('/') : true
+ value ? value?.startsWith('http') && value.includes('://') && !value?.endsWith('/') : true,
+ defaultValue: () => window.location.origin
},
{
label: 'Request Size Limit In MB',