/courtyard/* and /chatzer/* admitted any `Authorization: Bearer <x>`. Every test sent `Bearer test-token`; none sent a wrong one. Every admitted request spends the day's manna. VavPipeline.BigdeiKodesh.Gate: keys are a file (Construction §4.6 — never env, never config, never git), one `tier key` per line, tiers courtyard < chatzer (the inner ring opens the outer). Constant-time compare against every line; no file / empty / unreadable → nobody passes, GATE_NO_KEYS in the log, the caller told only "missing or invalid". 403 FORBIDDEN for an outer key at an inner gate. Read on every request so a rotated key is live in ~1 min without a rollout. Deploy: Secret shorashim-api-keys projected at /etc/shorashim/secrets/api_keys (vav-pipeline only, 0440), API_KEYS_FILE in the configmap, template + issue/rotate recipe in secrets.yaml and KOHEN.md "Issuing a key". Spec: tamid §1.1 (gate, 403), vayakhel §4.6. Doorpost 91d09d8d… → 42b38626…. Tests: tablet45_gate_test (parse, tiers, wrong/near/empty/no key, no file) — Elixir 527/0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
49 lines
2.2 KiB
Elixir
49 lines
2.2 KiB
Elixir
import Config
|
|
|
|
# Runtime configuration — read from environment variables at boot.
|
|
# This file is evaluated at runtime, not compile time.
|
|
# Required for OTP releases where env vars aren't known at build time.
|
|
|
|
if config_env() == :prod do
|
|
# L3 — PostgreSQL connection
|
|
# The kohen sets DATABASE_URL in the K8s secret
|
|
database_url =
|
|
System.get_env("DATABASE_URL") ||
|
|
raise """
|
|
DATABASE_URL not set.
|
|
The kohen must set the DATABASE_URL in shorashim-secrets.
|
|
Format: ecto://user:password@host:port/database?sslmode=require
|
|
"""
|
|
|
|
config :vav_pipeline, VavPipeline.Repo,
|
|
url: database_url,
|
|
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "20"),
|
|
ssl: true,
|
|
ssl_opts: [verify: :verify_none]
|
|
|
|
# L1 mount point — overridable via env
|
|
config :vav_pipeline,
|
|
l1_mount_point: System.get_env("L1_MOUNT_POINT") || "/mnt/torah",
|
|
manna_provision_file:
|
|
System.get_env("MANNA_PROVISION_FILE") || "/var/lib/shorashim/manna/today.json",
|
|
talmudic_socket_path:
|
|
System.get_env("TALMUDIC_SOCKET_PATH") || "/tmp/shorashim/talmudic.sock",
|
|
korban_socket_path:
|
|
System.get_env("KORBAN_SOCKET_PATH") || "/tmp/shorashim/korban.sock",
|
|
# The keys themselves are in the file (a mounted Secret), not in env.
|
|
api_keys_file: System.get_env("API_KEYS_FILE") || "/etc/shorashim/secrets/api_keys",
|
|
# Shoresh Engine binary — VavPipeline.ShoreshEnginePort opens an
|
|
# Erlang Port with {:spawn_executable, binary}, which spawns a CHILD
|
|
# PROCESS OF THIS CONTAINER. A Port cannot cross a container
|
|
# boundary, so the Haskell binary has to be on this container's
|
|
# filesystem, not only in the shoresh-engine image. deployment.yaml
|
|
# stages it onto a shared volume with an init container and points
|
|
# this variable at it. Without the override, Application.
|
|
# maybe_add_shoresh_port/3 finds nothing on PATH and logs
|
|
# "running without Haskell engine" — the system comes up DEGRADED
|
|
# and says so only in a warning line.
|
|
shoresh_engine_binary:
|
|
System.get_env("SHORESH_ENGINE_BINARY") || "shoresh-engine",
|
|
http_port: String.to_integer(System.get_env("HTTP_PORT") || "4000")
|
|
end
|