|
1 | | -"""Boot the Python router for conformance testing, pointed at the mock Monad.""" |
| 1 | +"""Boot the Python router for conformance testing. |
| 2 | +
|
| 3 | +Default (mock) mode points at the in-memory mock via ``MONAD_API_BASE``; live |
| 4 | +mode sets the same knobs to real Monad staging values. Every value falls back to |
| 5 | +the mock fixture default, so nothing changes for the existing hermetic run. |
| 6 | +""" |
2 | 7 |
|
3 | 8 | import os |
4 | 9 |
|
|
7 | 12 |
|
8 | 13 | from monad_embed import EmbedConfig, Provision, embed_router |
9 | 14 |
|
| 15 | +# A provisioned id may be intentionally empty (a live tenant with no store) → |
| 16 | +# treat "" as "not provisioned" so the router falls back to a dev/null sink. |
| 17 | +_store = os.environ.get("MONAD_STORE_ID", "out_store") or None |
| 18 | +_source = os.environ.get("MONAD_SOURCE_ID", "in_source") or None |
| 19 | +# Empty allow-list → expose the whole catalog (None), never the empty set. |
| 20 | +_allow = [s.strip() for s in os.environ.get("MONAD_CATALOG_ALLOW", "aws-cloudtrail,okta-systemlog").split(",") if s.strip()] or None |
| 21 | + |
10 | 22 | app = FastAPI() |
11 | 23 | app.include_router( |
12 | 24 | embed_router( |
13 | 25 | EmbedConfig( |
14 | | - api_key="conf-key", |
| 26 | + api_key=os.environ.get("MONAD_API_KEY", "conf-key"), |
15 | 27 | api_base=os.environ["MONAD_API_BASE"], |
16 | | - frame_origin="https://app.monad.com/embed", |
17 | | - get_customer_org_id=lambda req: "org_conf", |
18 | | - get_provisioned_components=lambda org: Provision(destination_output_id="out_store", source_input_id="in_source"), |
19 | | - catalog_allow=["aws-cloudtrail", "okta-systemlog"], |
| 28 | + frame_origin=os.environ.get("MONAD_FRAME_ORIGIN", "https://app.monad.com/embed"), |
| 29 | + get_customer_org_id=lambda req: os.environ.get("MONAD_ORG_ID", "org_conf"), |
| 30 | + get_provisioned_components=lambda org: Provision(destination_output_id=_store, source_input_id=_source), |
| 31 | + catalog_allow=_allow, |
20 | 32 | ) |
21 | 33 | ), |
22 | 34 | prefix="/embed", |
|
0 commit comments