Skip to content

Commit 7ebf0fb

Browse files
committed
get ENV at runtime, not buildtime
1 parent 86cda4b commit 7ebf0fb

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/AnythingLLMDocs.jl

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@ using Documenter.DocSystem
66
using HTTP
77
using JSON
88

9-
const DEFAULT_API_BASE = get(
10-
ENV,
11-
"ANYTHINGLLM_API_BASE",
12-
"https://anythingllm.krastanov.org/api/v1",
13-
)
14-
const DEFAULT_API_KEY = get(ENV, "ANYTHINGLLM_API_KEY", "")
15-
const DEFAULT_ALLOWLIST = get(ENV, "ANYTHINGLLM_ALLOWLIST", "")
16-
const DEFAULT_GREETING = "This is an LLM helper with access to the entirety of the docs. You can directly ask it your questions."
9+
default_api_base() = get(ENV, "ANYTHINGLLM_API_BASE", "")
10+
default_api_key() = get(ENV, "ANYTHINGLLM_API_KEY", "")
11+
default_allowlist() = get(ENV, "ANYTHINGLLM_ALLOWLIST", "")
1712

1813
"""
1914
Configuration for connecting to an AnythingLLM instance.
@@ -40,9 +35,9 @@ end
4035

4136
"""Create a configuration, normalizing defaults and derived host values."""
4237
function AnythingLLMConfig(;
43-
api_base::String=DEFAULT_API_BASE,
44-
api_key::String=DEFAULT_API_KEY,
45-
allowlist::String=DEFAULT_ALLOWLIST,
38+
api_base::String=default_api_base(),
39+
api_key::String=default_api_key(),
40+
allowlist::String=default_allowlist(),
4641
embed_host::Union{Nothing,String}=nothing,
4742
)
4843
clean_base = strip_trailing_slash(api_base)
@@ -313,7 +308,7 @@ Base.@kwdef mutable struct EmbedOptions
313308
user_bg_color::String = ""
314309
assistant_bg_color::String = ""
315310
brand_image_url::String = ""
316-
greeting::String = DEFAULT_GREETING
311+
greeting::String = "This is an LLM helper with access to the entirety of the docs. You can directly ask it your questions."
317312
no_sponsor::String = ""
318313
no_header::String = ""
319314
sponsor_link::String = ""

0 commit comments

Comments
 (0)