Files
org-garden/config/runtime.exs
Ignacio Ballesteros 87fd311005 Add parallel export with configurable concurrency (default: 8)
Use Task.async_stream for parallel org->md export.
Configurable via EXPORT_CONCURRENCY env var or :export_concurrency config.
2026-02-21 21:37:27 +01:00

47 lines
1.4 KiB
Elixir

import Config
# Runtime configuration from environment variables
# This file is executed at runtime (not compile time)
defmodule RuntimeConfig do
def parse_int(nil, default), do: default
def parse_int(val, _default) when is_integer(val), do: val
def parse_int(val, default) when is_binary(val) do
case Integer.parse(val) do
{int, ""} -> int
_ -> default
end
end
def parse_citation_mode("silent"), do: :silent
def parse_citation_mode("strict"), do: :strict
def parse_citation_mode(_), do: :warn
end
# Core paths
if quartz_path = System.get_env("QUARTZ_PATH") do
config :org_garden, quartz_path: quartz_path
end
config :org_garden,
node_path: System.get_env("NODE_PATH", "node"),
notes_dir: System.get_env("NOTES_DIR"),
output_dir: System.get_env("OUTPUT_DIR")
# Citation configuration
config :org_garden,
zotero_url: System.get_env("ZOTERO_URL", "http://localhost:23119"),
bibtex_file: System.get_env("BIBTEX_FILE"),
citation_mode: RuntimeConfig.parse_citation_mode(System.get_env("CITATION_MODE"))
# Server ports
config :org_garden,
http_port: RuntimeConfig.parse_int(System.get_env("PORT"), 8080),
ws_port: RuntimeConfig.parse_int(System.get_env("WS_PORT"), 3001),
health_port: RuntimeConfig.parse_int(System.get_env("HEALTH_PORT"), 9090)
# Export parallelism
config :org_garden,
export_concurrency: RuntimeConfig.parse_int(System.get_env("EXPORT_CONCURRENCY"), 8)