tangled
alpha
login
or
join now
ptr.pet
/
hydrant
25
fork
atom
at protocol indexer with flexible filtering, xrpc queries, and a cursor-backed event stream, built on fjall
at-protocol
atproto
indexer
rust
fjall
25
fork
atom
overview
issues
6
pulls
pipelines
[config] remove LOG_LEVEL, use RUST_LOG instead
ptr.pet
1 day ago
8990a2ff
88cb2848
verified
This commit was signed with the committer's
known signature
.
ptr.pet
SSH Key Fingerprint:
SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw=
+9
-15
4 changed files
expand all
collapse all
unified
split
README.md
src
backfill
mod.rs
config.rs
main.rs
+2
-2
README.md
···
22
22
23
23
## configuration
24
24
25
25
-
`hydrant` is configured via environment variables. all variables are prefixed with `HYDRANT_`.
25
25
+
`hydrant` is configured via environment variables. all variables are prefixed with `HYDRANT_` (except `RUST_LOG`).
26
26
27
27
| variable | default | description |
28
28
| :--- | :--- | :--- |
29
29
| `DATABASE_PATH` | `./hydrant.db` | path to the database folder. |
30
30
-
| `LOG_LEVEL` | `info` | log level (e.g., `debug`, `info`, `warn`, `error`). |
30
30
+
| `RUST_LOG` | `info` | log filter directives (e.g., `debug`, `hydrant=trace`). standard [`tracing` env-filter syntax](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html). |
31
31
| `RELAY_HOST` | `wss://relay.fire.hose.cam` | websocket URL of the upstream firehose relay. |
32
32
| `PLC_URL` | `https://plc.wtf` | base URL(s) of the PLC directory (comma-separated for multiple). |
33
33
| `FULL_NETWORK` | `false` | if `true`, discovers and indexes all repositories in the network. |
+4
-6
src/backfill/mod.rs
···
749
749
// signal mode: no signal-matching records found — clean up the optimistically-added repo
750
750
let did_key = keys::repo_key(did);
751
751
let backfill_pending_key = keys::pending_key(previous_state.index_id);
752
752
-
let repos_ks = app_state.db.repos.clone();
753
753
-
let pending_ks = app_state.db.pending.clone();
754
754
-
let db_inner = app_state.db.inner.clone();
752
752
+
let app_state = app_state.clone();
755
753
tokio::task::spawn_blocking(move || {
756
756
-
let mut batch = db_inner.batch();
757
757
-
batch.remove(&repos_ks, &did_key);
758
758
-
batch.remove(&pending_ks, backfill_pending_key);
754
754
+
let mut batch = app_state.db.inner.batch();
755
755
+
batch.remove(&app_state.db.repos, &did_key);
756
756
+
batch.remove(&app_state.db.pending, backfill_pending_key);
759
757
batch.commit().into_diagnostic()
760
758
})
761
759
.await
-6
src/config.rs
···
1
1
use miette::Result;
2
2
-
use smol_str::SmolStr;
3
2
use std::fmt;
4
3
use std::path::PathBuf;
5
4
use std::str::FromStr;
···
44
43
pub ephemeral: bool,
45
44
pub cursor_save_interval: Duration,
46
45
pub repo_fetch_timeout: Duration,
47
47
-
pub log_level: SmolStr,
48
46
pub api_port: u16,
49
47
pub cache_size: u64,
50
48
pub backfill_concurrency_limit: usize,
···
92
90
};
93
91
}
94
92
95
95
-
let log_level = cfg!("LOG_LEVEL", "info");
96
96
-
97
93
let relay_host = cfg!(
98
94
"RELAY_HOST",
99
95
Url::parse("wss://relay.fire.hose.cam").unwrap()
···
190
186
full_network,
191
187
cursor_save_interval,
192
188
repo_fetch_timeout,
193
193
-
log_level,
194
189
api_port,
195
190
cache_size,
196
191
backfill_concurrency_limit,
···
230
225
const LABEL_WIDTH: usize = 27;
231
226
232
227
writeln!(f, "hydrant configuration:")?;
233
233
-
config_line!(f, "log level", self.log_level)?;
234
228
config_line!(f, "relay host", self.relay_host)?;
235
229
config_line!(f, "plc urls", format_args!("{:?}", self.plc_urls))?;
236
230
config_line!(f, "full network indexing", self.full_network)?;
+3
-1
src/main.rs
···
22
22
23
23
let cfg = Config::from_env()?;
24
24
25
25
-
let env_filter = tracing_subscriber::EnvFilter::new(&cfg.log_level);
25
25
+
let env_filter = tracing_subscriber::EnvFilter::builder()
26
26
+
.with_default_directive(tracing::Level::INFO.into())
27
27
+
.from_env_lossy();
26
28
tracing_subscriber::fmt().with_env_filter(env_filter).init();
27
29
28
30
info!("{cfg}");