feat: replace my_codegen with actix_web_codegen_const_routes

This commit is contained in:
Aravinth Manivannan 2022-09-10 18:31:05 +05:30
parent d6fc9ad67f
commit 086c4f5911
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
5 changed files with 14 additions and 13 deletions

16
Cargo.lock generated
View File

@ -144,7 +144,7 @@ dependencies = [
"actix-server", "actix-server",
"actix-service", "actix-service",
"actix-utils", "actix-utils",
"actix-web-codegen 4.0.1", "actix-web-codegen",
"ahash", "ahash",
"bytes", "bytes",
"bytestring", "bytestring",
@ -172,8 +172,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-web-codegen" name = "actix-web-codegen"
version = "4.0.0" version = "4.0.1"
source = "git+https://github.com/realaravinth/actix-web#8a399b6e7ea6ffdf241d07a9e907b1afff7e0fe6" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f270541caec49c15673b0af0e9a00143421ad4f118d2df7edcb68b627632f56"
dependencies = [ dependencies = [
"actix-router", "actix-router",
"proc-macro2", "proc-macro2",
@ -182,10 +183,9 @@ dependencies = [
] ]
[[package]] [[package]]
name = "actix-web-codegen" name = "actix-web-codegen-const-routes"
version = "4.0.1" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/realaravinth/actix-web-codegen-const-routes?tag=0.1.0#1cc9b8dbaaef4b3634dabbf537f313200dd91bd9"
checksum = "5f270541caec49c15673b0af0e9a00143421ad4f118d2df7edcb68b627632f56"
dependencies = [ dependencies = [
"actix-router", "actix-router",
"proc-macro2", "proc-macro2",
@ -920,7 +920,7 @@ dependencies = [
"actix-http", "actix-http",
"actix-rt", "actix-rt",
"actix-web", "actix-web",
"actix-web-codegen 4.0.0", "actix-web-codegen-const-routes",
"config", "config",
"derive_more", "derive_more",
"git2", "git2",

View File

@ -16,7 +16,8 @@ authors = ["realaravinth <realaravinth@batsense.net>"]
actix-web = "4.0.1" actix-web = "4.0.1"
actix-http = "3.0.4" actix-http = "3.0.4"
actix-rt = "2" actix-rt = "2"
my-codegen = {package = "actix-web-codegen", git ="https://github.com/realaravinth/actix-web"} actix-web-codegen-const-routes = { version = "0.1.0", tag = "0.1.0", git = "https://github.com/realaravinth/actix-web-codegen-const-routes" }
config = "0.13" config = "0.13"
git2 = "0.14.2" git2 = "0.14.2"

View File

@ -53,7 +53,7 @@ pub fn find_page<'a>(secret: &str, ctx: &'a AppCtx) -> Option<&'a Page> {
None None
} }
#[my_codegen::post(path = "crate::V1_API_ROUTES.deploy.update")] #[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.deploy.update")]
async fn update(payload: web::Json<DeployEvent>, ctx: AppCtx) -> ServiceResult<impl Responder> { async fn update(payload: web::Json<DeployEvent>, ctx: AppCtx) -> ServiceResult<impl Responder> {
if let Some(page) = find_page(&payload.secret, &ctx) { if let Some(page) = find_page(&payload.secret, &ctx) {
let (tx, rx) = oneshot::channel(); let (tx, rx) = oneshot::channel();
@ -98,7 +98,7 @@ impl DeployInfo {
} }
} }
#[my_codegen::post(path = "crate::V1_API_ROUTES.deploy.info")] #[actix_web_codegen_const_routes::post(path = "crate::V1_API_ROUTES.deploy.info")]
async fn deploy_info( async fn deploy_info(
payload: web::Json<DeploySecret>, payload: web::Json<DeploySecret>,
ctx: AppCtx, ctx: AppCtx,

View File

@ -43,7 +43,7 @@ pub mod routes {
} }
/// emmits build details of the bninary /// emmits build details of the bninary
#[my_codegen::get(path = "crate::V1_API_ROUTES.meta.build_details")] #[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.meta.build_details")]
async fn build_details(ctx: AppCtx) -> impl Responder { async fn build_details(ctx: AppCtx) -> impl Responder {
let build = BuildDetails { let build = BuildDetails {
version: VERSION, version: VERSION,

View File

@ -47,7 +47,7 @@ pub fn find_page<'a>(domain: &str, ctx: &'a AppCtx) -> Option<&'a Page> {
None None
} }
#[my_codegen::get(path = "crate::V1_API_ROUTES.serve.catch_all")] #[actix_web_codegen_const_routes::get(path = "crate::V1_API_ROUTES.serve.catch_all")]
async fn index(req: HttpRequest, ctx: AppCtx) -> ServiceResult<impl Responder> { async fn index(req: HttpRequest, ctx: AppCtx) -> ServiceResult<impl Responder> {
let c = req.connection_info(); let c = req.connection_info();
let mut host = c.host(); let mut host = c.host();