refactor(config): refresh all typed sections in central lib/config crate
All 23 typed config sections (app, auth, cache, chat, db, duration, email, error, git, issues, jwt, lib, loader, payment, pow, project, queue, rate_limit, repo, search, space, storage, user) updated to current schema used by the per-crate migrations.
zhenyi committed
Modified lib/config/src/app.rs lib/config/src/app.rs +4 −2 View lib/config/src/app.rs
@@ -8,6 +8,7 @@
88use crate::git;
99use crate::issues;
1010use crate::jwt;
11use crate::live;
1112use crate::payment;
1213use crate::pow;
1314use crate::project;
@@ -41,6 +42,7 @@
4142 pub search: search::AppSearchSettings,
4243 pub chat: chat::AppChatSettings,
4344 pub gateway: chat::GatewaySettings,
45 pub live: live::LiveSettings,
4446 pub git_smart: git::SmartConfig,
4547 pub git_ssh: git::GitSshConfig,
4648 pub git_auth: git::GitAuthConfig,
@@ -48,7 +50,7 @@
4850}
4951
5052impl AppConfig {
51 pub fn validate(&self) -> Result<(), String> {
53 pub fn validate(&self) -> Result<(), String> {
5254 self.email.is_valid()?;
5355 self.queue.is_valid()?;
5456 self.search.is_valid()?;
@@ -67,4 +69,4 @@
6769 }
6870 Ok(())
6971 }
70}
No newline at end of file
72}
Modified lib/config/src/auth.rs lib/config/src/auth.rs +1 −1 View lib/config/src/auth.rs
@@ -200,4 +200,4 @@
200200}
201201
202202#[allow(dead_code)]
203pub type SharedAuthConfig = Arc<AuthConfig>;
No newline at end of file
203pub type SharedAuthConfig = Arc<AuthConfig>;
Modified lib/config/src/cache.rs lib/config/src/cache.rs +4 −2 View lib/config/src/cache.rs
@@ -30,7 +30,9 @@
3030 }
3131}
3232
33#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq, Eq, Getter, Setter, Builder)]
33#[derive(
34 Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq, Eq, Getter, Setter, Builder,
35)]
3436#[serde(default)]
3537pub struct AppRedisSettings {
3638 pub urls: Vec<String>,
@@ -60,4 +62,4 @@
6062 database: Some(0),
6163 }
6264 }
63}
No newline at end of file
65}
Modified lib/config/src/chat.rs lib/config/src/chat.rs +5 −2 View lib/config/src/chat.rs
@@ -8,6 +8,7 @@
88 pub room_group_id: String,
99 pub user_group_id: String,
1010 pub user_view_group_id: String,
11 pub live_group_id: String,
1112 pub dedup_ttl_seconds: u64,
1213 pub idempotency_ttl_seconds: u64,
1314 pub upload_ttl_seconds: u64,
@@ -23,6 +24,7 @@
2324 room_group_id: "chat.room.v1".to_string(),
2425 user_group_id: "chat.user.v1".to_string(),
2526 user_view_group_id: "chat.user.view.v1".to_string(),
27 live_group_id: "chat.live.v1".to_string(),
2628 dedup_ttl_seconds: 24 * 3600,
2729 idempotency_ttl_seconds: 24 * 3600,
2830 upload_ttl_seconds: 3600,
@@ -40,7 +42,7 @@
4042 pub ws_auth_timeout_seconds: u64,
4143 pub max_connections_per_user: usize,
4244 pub subscriber_id: String,
43 pub topic_prefix: String,
45 pub topic_prefix: String,
4446 pub upload_presign_ttl_seconds: u64,
4547 pub typing_debounce_seconds: u64,
4648}
@@ -72,6 +74,7 @@
7274 assert_eq!(s.room_group_id, "chat.room.v1");
7375 assert_eq!(s.user_group_id, "chat.user.v1");
7476 assert_eq!(s.user_view_group_id, "chat.user.view.v1");
77 assert_eq!(s.live_group_id, "chat.live.v1");
7578 assert_eq!(s.dedup_ttl_seconds, 24 * 3600);
7679 assert_eq!(s.idempotency_ttl_seconds, 24 * 3600);
7780 assert_eq!(s.upload_ttl_seconds, 3600);
@@ -100,4 +103,4 @@
100103 assert_eq!(back.topic_prefix, s.topic_prefix);
101104 assert_eq!(back.max_connections_per_user, s.max_connections_per_user);
102105 }
103}
No newline at end of file
106}
Modified lib/config/src/db.rs lib/config/src/db.rs +7 −3 View lib/config/src/db.rs
@@ -1,6 +1,8 @@
11use lombok::{Builder, Getter, Setter};
22
3#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq, Eq, Getter, Setter, Builder)]
3#[derive(
4 Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq, Eq, Getter, Setter, Builder,
5)]
46#[serde(default)]
57pub struct AppDatabaseSettings {
68 pub primary: AppDatabaseConnConfig,
@@ -12,7 +14,9 @@
1214 pub slow_query_threshold_ms: u64,
1315}
1416
15#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq, Eq, Getter, Setter, Builder)]
17#[derive(
18 Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq, Eq, Getter, Setter, Builder,
19)]
1620#[serde(default)]
1721pub struct AppDatabaseConnConfig {
1822 pub url: String,
@@ -52,4 +56,4 @@
5256 application_name: Some("gitdataai".to_string()),
5357 }
5458 }
55}
No newline at end of file
59}
Modified lib/config/src/duration.rs lib/config/src/duration.rs +1 −1 View lib/config/src/duration.rs
@@ -173,4 +173,4 @@
173173 let w: OptStdWrap = serde_json::from_str(r#"{"d":300}"#).unwrap();
174174 assert_eq!(w.d, Some(StdDuration::from_secs(300)));
175175 }
176}
No newline at end of file
176}
Modified lib/config/src/email.rs lib/config/src/email.rs +1 −1 View lib/config/src/email.rs
@@ -72,4 +72,4 @@
7272 }
7373 Ok(())
7474 }
75}
No newline at end of file
75}
Modified lib/config/src/error.rs lib/config/src/error.rs +1 −1 View lib/config/src/error.rs
@@ -8,4 +8,4 @@
88 Validation(String),
99}
1010
11pub type ConfigResult<T> = Result<T, ConfigError>;
No newline at end of file
11pub type ConfigResult<T> = Result<T, ConfigError>;
Modified lib/config/src/git.rs lib/config/src/git.rs +1 −1 View lib/config/src/git.rs
@@ -113,4 +113,4 @@
113113 pub fn language_timeout(&self) -> Duration {
114114 Duration::from_secs(self.language_timeout_secs)
115115 }
116}
No newline at end of file
116}
Modified lib/config/src/issues.rs lib/config/src/issues.rs +1 −1 View lib/config/src/issues.rs
@@ -104,4 +104,4 @@
104104 }
105105}
106106
107pub type SharedIssueConfig = Arc<IssueConfig>;
No newline at end of file
107pub type SharedIssueConfig = Arc<IssueConfig>;
Modified lib/config/src/jwt.rs lib/config/src/jwt.rs +1 −1 View lib/config/src/jwt.rs
@@ -36,4 +36,4 @@
3636 default_key_pair_algorithm: "EdDSA".to_string(),
3737 }
3838 }
39}
No newline at end of file
39}
Modified lib/config/src/lib.rs lib/config/src/lib.rs +2 −1 View lib/config/src/lib.rs
@@ -9,6 +9,7 @@
99pub mod git;
1010pub mod issues;
1111pub mod jwt;
12pub mod live;
1213pub mod loader;
1314pub mod payment;
1415pub mod pow;
@@ -23,4 +24,4 @@
2324
2425pub use app::AppConfig;
2526pub use error::{ConfigError, ConfigResult};
26pub use loader::{ConfigLoader, load};
No newline at end of file
27pub use loader::{ConfigLoader, load};
Modified lib/config/src/loader.rs lib/config/src/loader.rs +5 −7 View lib/config/src/loader.rs
@@ -78,14 +78,12 @@
7878
7979 let mut builder = config_rs::Config::builder();
8080 if let Some(path) = self.config_file {
81 builder = builder.add_source(
82 config_rs::File::with_name(&path.to_string_lossy()).required(false),
83 );
81 builder = builder
82 .add_source(config_rs::File::with_name(&path.to_string_lossy()).required(false));
8483 }
8584 if let Some(path) = self.local_config_file {
86 builder = builder.add_source(
87 config_rs::File::with_name(&path.to_string_lossy()).required(false),
88 );
85 builder = builder
86 .add_source(config_rs::File::with_name(&path.to_string_lossy()).required(false));
8987 }
9088 if self.use_env {
9189 builder = builder.add_source(
@@ -107,4 +105,4 @@
107105
108106pub fn load() -> ConfigResult<AppConfig> {
109107 ConfigLoader::new().load()
110}
No newline at end of file
108}
Modified lib/config/src/payment.rs lib/config/src/payment.rs +1 −1 View lib/config/src/payment.rs
@@ -42,4 +42,4 @@
4242
4343fn default_max_pagination() -> u64 {
4444 100
45}
No newline at end of file
45}
Modified lib/config/src/pow.rs lib/config/src/pow.rs +1 −1 View lib/config/src/pow.rs
@@ -36,4 +36,4 @@
3636 challenge_ttl: Duration::minutes(5),
3737 }
3838 }
39}
No newline at end of file
39}
Modified lib/config/src/project.rs lib/config/src/project.rs +1 −1 View lib/config/src/project.rs
@@ -24,4 +24,4 @@
2424 }
2525}
2626
27pub type SharedProjectConfig = Arc<ProjectConfig>;
No newline at end of file
27pub type SharedProjectConfig = Arc<ProjectConfig>;
Modified lib/config/src/queue.rs lib/config/src/queue.rs +1 −1 View lib/config/src/queue.rs
@@ -73,4 +73,4 @@
7373 }
7474 Ok(())
7575 }
76}
No newline at end of file
76}
Modified lib/config/src/rate_limit.rs lib/config/src/rate_limit.rs +1 −1 View lib/config/src/rate_limit.rs
@@ -31,4 +31,4 @@
3131 ..Self::default()
3232 }
3333 }
34}
No newline at end of file
34}
Modified lib/config/src/repo.rs lib/config/src/repo.rs +1 −1 View lib/config/src/repo.rs
@@ -116,4 +116,4 @@
116116 }
117117}
118118
119pub type SharedRepoConfig = Arc<RepoConfig>;
No newline at end of file
119pub type SharedRepoConfig = Arc<RepoConfig>;
Modified lib/config/src/search.rs lib/config/src/search.rs +1 −1 View lib/config/src/search.rs
@@ -127,4 +127,4 @@
127127 };
128128 assert!(cfg.is_valid().is_err());
129129 }
130}
No newline at end of file
130}
Modified lib/config/src/space.rs lib/config/src/space.rs +1 −1 View lib/config/src/space.rs
@@ -81,4 +81,4 @@
8181}
8282
8383#[allow(dead_code)]
84pub type SharedSpaceConfig = Arc<SpaceConfig>;
No newline at end of file
84pub type SharedSpaceConfig = Arc<SpaceConfig>;
Modified lib/config/src/storage.rs lib/config/src/storage.rs +1 −1 View lib/config/src/storage.rs
@@ -108,4 +108,4 @@
108108 &PathBuf::from("./storage")
109109 );
110110 }
111}
No newline at end of file
111}
Modified lib/config/src/user.rs lib/config/src/user.rs +1 −1 View lib/config/src/user.rs
@@ -155,4 +155,4 @@
155155}
156156
157157#[allow(dead_code)]
158pub type SharedUserConfig = Arc<UserConfig>;
No newline at end of file
158pub type SharedUserConfig = Arc<UserConfig>;