schema_config_toml/lib.rs
1#![doc = include_str!("../README.md")]
2
3pub mod entities;
4mod env_value;
5mod parser;
6
7pub use env_value::EnvOrValue;
8pub use parser::ParseError;
9
10/// The JSON Schema describing a `flusso.toml` config file, embedded from this
11/// crate's `schemas/` directory for editor assist and programmatic access (both
12/// re-exported from `schema` and emitted by `flusso schema config`). Kept in
13/// lockstep with this parser by `schema`'s `schema_drift` test.
14pub const CONFIG_SCHEMA: &str = include_str!("../config.schema.json");
15
16use serde::{Deserialize, Serialize};
17use std::collections::BTreeMap;
18
19use entities::IndexEntry;
20use entities::Server;
21use entities::Sink;
22use entities::Source;
23use schema_core::common;
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(deny_unknown_fields)]
27pub struct ConfigToml {
28 pub source: Source,
29 #[serde(default)]
30 pub sinks: BTreeMap<common::SinkName, Sink>,
31 #[serde(default)]
32 pub index: Vec<IndexEntry>,
33 /// Literal prefix prepended to every index name flusso owns, so several
34 /// deployments can share one OpenSearch cluster without colliding. The
35 /// `--index-prefix` flag / `FLUSSO_INDEX_PREFIX` env var override it at
36 /// runtime (which win); see the [configuration
37 /// guide](https://alias2k.github.io/flusso/guides/configuration.html). Empty
38 /// (the default) means no prefix.
39 #[serde(default)]
40 pub prefix: String,
41 /// Global item-level rejection policy; per-index overrides live on each
42 /// [`IndexEntry`]. Defaults to [`FailurePolicy::Stop`](schema_core::FailurePolicy::Stop).
43 #[serde(default)]
44 pub on_error: schema_core::FailurePolicy,
45 /// Bind addresses for the operational HTTP surfaces. The binary layers
46 /// `FLUSSO_*` env vars and CLI flags on top (which win); see the
47 /// [configuration guide](https://alias2k.github.io/flusso/guides/configuration.html).
48 #[serde(default)]
49 pub server: Server,
50}