-
-
Notifications
You must be signed in to change notification settings - Fork 7
[api] Move test_server to agdb_api and add it to typedef #1780 #1792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
michaelvlach
merged 9 commits into
main
from
1780-api-define-tests-to-be-part-of-the-api-type_def
May 1, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7c2cb2e
copy test_server to agdb_api
michaelvlach 6951b7c
wip
michaelvlach d29cee3
Merge branch 'main' into 1780-api-define-tests-to-be-part-of-the-api-…
michaelvlach 641eb5c
update the test_server definition
michaelvlach d671f8d
use test_server from agdb_api
michaelvlach 2b194d1
Update misc_routes.rs
michaelvlach 635811d
fix formatting
michaelvlach 17599ca
update based on PR comments
michaelvlach 0d6d43b
Update test_error.rs
michaelvlach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| pub mod config_impl; | ||
|
|
||
| use agdb::DbError; | ||
| use agdb::DbSerialize; | ||
| use agdb::DbValue; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| use crate::LogLevelFilter; | ||
|
|
||
| pub const SALT_LEN: usize = 16; | ||
| pub const DEFAULT_LOG_BODY_LIMIT: u64 = 10 * 1024; | ||
| pub const DEFAULT_REQUEST_BODY_LIMIT: u64 = 10 * 1024 * 1024; | ||
|
|
||
| #[derive(Debug)] | ||
| #[cfg_attr(feature = "api", derive(agdb::TypeDefImpl))] | ||
| pub struct ConfigImpl { | ||
| pub bind: String, | ||
| pub address: String, | ||
| pub basepath: String, | ||
| pub static_roots: Vec<String>, | ||
| pub admin: String, | ||
| pub log_level: LogLevelFilter, | ||
| pub log_body_limit: u64, | ||
| pub request_body_limit: u64, | ||
| pub data_dir: String, | ||
| pub pepper_path: String, | ||
| pub tls_certificate: String, | ||
| pub tls_key: String, | ||
| pub tls_root: String, | ||
| pub cluster_token: String, | ||
| pub cluster_heartbeat_timeout_ms: u64, | ||
| pub cluster_term_timeout_ms: u64, | ||
| pub cluster: Vec<String>, | ||
| pub cluster_node_id: usize, | ||
| pub start_time: u64, | ||
| pub pepper: Option<[u8; SALT_LEN]>, | ||
| } | ||
|
|
||
| impl ConfigImpl { | ||
| pub fn server_url(&self) -> String { | ||
| format!("{}{}", self.address, self.basepath) | ||
| } | ||
| } | ||
|
|
||
| #[cfg_attr(feature = "api", agdb::fn_def())] | ||
| pub fn config_to_str(config: &ConfigImpl) -> String { | ||
| let mut buffer = String::new(); | ||
| buffer.push_str(&format!("bind: {}\n", config.bind)); | ||
| buffer.push_str(&format!("address: {}\n", config.address)); | ||
| buffer.push_str(&format!("basepath: {}\n", config.basepath)); | ||
| buffer.push_str(&format!( | ||
| "static_roots: {}\n", | ||
| config.static_roots.join(", ") | ||
| )); | ||
| buffer.push_str(&format!("admin: {}\n", config.admin)); | ||
| buffer.push_str(&format!("log_level: {}\n", config.log_level)); | ||
| buffer.push_str(&format!("log_body_limit: {}\n", config.log_body_limit)); | ||
| buffer.push_str(&format!( | ||
| "request_body_limit: {}\n", | ||
| config.request_body_limit | ||
| )); | ||
| buffer.push_str(&format!("data_dir: {}\n", config.data_dir)); | ||
| buffer.push_str(&format!("pepper_path: {}\n", config.pepper_path)); | ||
| buffer.push_str(&format!("tls_certificate: {}\n", config.tls_certificate)); | ||
| buffer.push_str(&format!("tls_key: {}\n", config.tls_key)); | ||
| buffer.push_str(&format!("tls_root: {}\n", config.tls_root)); | ||
| buffer.push_str(&format!("cluster_token: {}\n", config.cluster_token)); | ||
|
|
||
| buffer.push_str(&format!( | ||
| "cluster_heartbeat_timeout_ms: {}\n", | ||
| config.cluster_heartbeat_timeout_ms | ||
| )); | ||
| buffer.push_str(&format!( | ||
| "cluster_term_timeout_ms: {}\n", | ||
| config.cluster_term_timeout_ms | ||
| )); | ||
| buffer.push_str(&format!("cluster: [{}]\n", config.cluster.join(", "))); | ||
| buffer | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.