Skip to main content

jax_daemon/
service_config.rs

1use std::net::SocketAddr;
2use std::path::PathBuf;
3
4use common::prelude::SecretKey;
5
6use crate::state::BlobStoreConfig;
7
8#[derive(Debug)]
9pub struct Config {
10    // peer configuration
11    /// address for our jax peer to listen on,
12    ///  if not set then an ephemeral port will be used
13    pub node_listen_addr: Option<SocketAddr>,
14    /// on system file path to our secret,
15    ///  if not set then a new secret will be generated
16    pub node_secret: Option<SecretKey>,
17
18    // blob store configuration
19    /// Blob storage backend configuration
20    pub blob_store: BlobStoreConfig,
21    /// Path to the jax directory (absolute path, used for legacy blobs and cache)
22    pub jax_dir: PathBuf,
23    /// Maximum blob size allowed for BAO imports (bytes)
24    pub max_import_size: u64,
25
26    // http server configuration - separate ports for API and gateway
27    /// Port for the API HTTP server (private, mutation/RPC).
28    pub api_port: u16,
29    /// Port for the gateway HTTP server (public, read-only).
30    pub gateway_port: u16,
31
32    // data store configuration
33    /// a path to a sqlite database, if not set then an
34    ///  in-memory database will be used
35    pub sqlite_path: Option<PathBuf>,
36
37    // logging
38    pub log_level: tracing::Level,
39    /// Directory for log files (optional, logs to stdout only if not set)
40    pub log_dir: Option<PathBuf>,
41
42    // url configuration
43    /// External gateway URL (e.g., "https://gateway.example.com")
44    /// Used for generating share/download links
45    pub gateway_url: Option<String>,
46}
47
48// TODO (amiller68): real error handling
49#[allow(dead_code)]
50#[derive(Debug, thiserror::Error)]
51pub enum ConfigError {}