summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongheng Liu <z.liu@outlook.com.gr>2024-12-24 12:45:55 +0200
committerZhongheng Liu <z.liu@outlook.com.gr>2024-12-24 12:45:55 +0200
commitb2390f7cbab63915a24d23f04d2b5e3eb57ff1a1 (patch)
treeb35ef42bbf4008f66158ab64b003c3949cec2f27
parent6318ba136713965b297ba828958faa9e378da08d (diff)
downloadgit_service-b2390f7cbab63915a24d23f04d2b5e3eb57ff1a1.tar.gz
git_service-b2390f7cbab63915a24d23f04d2b5e3eb57ff1a1.tar.bz2
git_service-b2390f7cbab63915a24d23f04d2b5e3eb57ff1a1.zip
feat: some kind of initial web server
warp: add /ping endpoint, kind of health check
-rw-r--r--src/main.rs41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/main.rs b/src/main.rs
index d517a6c..baa8c8b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,26 +1,31 @@
use core::panic;
-
-use git2::BranchType;
-
mod cgit_helper;
mod git_tools;
-fn main() {
+mod read_config;
+use cgit_helper::cgit_add_repo;
+use git_tools::make_repo;
+use read_config::{get_config, Config};
+use serde::Deserialize;
+use warp::Filter;
+#[derive(Debug, Deserialize)]
+struct MakeRepoRequest {
+ repo_name: String,
+ author: String,
+ sig_text: String,
+}
+fn make_repo_request_handler(config: Config) {
println!("Hello, world!");
- let repository = match git_tools::make_repo("any_test.git", "z.liu@outlook.com.gr") {
+ let _repository = match make_repo("any_test.git", "z.liu@outlook.com.gr") {
Ok(repo) => repo,
Err(_e) => panic!("Something went wrong during repo init"),
};
- repository.branches(Some(BranchType::Local)).map_or_else(
- |_err| panic!("branch parse error"),
- |branches| {
- branches.for_each(|branch_result| match branch_result {
- Ok(branch) => {
- println!("{:?}", branch.0.name().unwrap());
- }
- Err(_e) => {
- panic!("error stuff");
- }
- })
- },
- )
+ let section_name = String::from("custom");
+ cgit_add_repo(config.cgitrepos_file_path, section_name);
+}
+#[tokio::main]
+async fn main() {
+ let _config: Config = get_config("./config.local.json".to_string());
+ let ping = warp::path!("ping").map(|| "pong");
+ warp::serve(ping).run(([127, 0, 0, 1], 7070)).await;
+ //make_repo_request_handler(config);
}