atomr_infer_cli/
config.rs1use std::path::Path;
4
5use serde::{Deserialize, Serialize};
6
7use atomr_infer_core::deployment::Deployment;
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct ProjectFile {
11 pub cluster: ClusterConfig,
12 #[serde(default, rename = "deployment")]
13 pub deployments: Vec<Deployment>,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct ClusterConfig {
18 pub name: String,
19 #[serde(default = "default_bind")]
21 pub bind: std::net::SocketAddr,
22 #[serde(default)]
24 pub endpoint: Option<String>,
25}
26
27fn default_bind() -> std::net::SocketAddr {
28 "127.0.0.1:8080".parse().expect("static addr")
29}
30
31impl ProjectFile {
32 pub fn from_path(path: impl AsRef<Path>) -> anyhow::Result<Self> {
33 let body = std::fs::read_to_string(path.as_ref())?;
34 Ok(toml::from_str(&body)?)
35 }
36}