Skip to content

Commit a553fbc

Browse files
committed
feat: added appendix for rest module
1 parent 8eedeb6 commit a553fbc

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

adapter/rest/src/main.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use base::{
33
store::{FlowExecutionResult, FlowIdentifyResult},
44
traits::Server as ServerTrait,
55
};
6+
use code0_flow::flow_service::ModuleDefinitionAppendix;
67
use http_body_util::{BodyExt, Full};
78
use hyper::server::conn::http1;
89
use hyper::{Request, Response};
@@ -17,7 +18,7 @@ use std::sync::Arc;
1718
use tokio::net::TcpListener;
1819
use tonic::async_trait;
1920
use tucana::shared::{
20-
AdapterStatusConfiguration, Struct, ValidationFlow, Value, helper::value::ToValue, value::Kind,
21+
Endpoint, ModuleDefinition, Struct, ValidationFlow, Value, helper::value::ToValue, value::Kind,
2122
};
2223

2324
use crate::response::{error_to_http_response, value_to_http_response};
@@ -42,14 +43,18 @@ async fn main() {
4243
let addr = runner.get_server_config().port;
4344
let host = runner.get_server_config().host.clone();
4445

45-
let configs = vec![AdapterStatusConfiguration {
46-
flow_type_identifiers: vec![String::from("REST")],
47-
data: Some(
48-
tucana::shared::adapter_status_configuration::Data::Endpoint(format!(
49-
r"{}:{}/${{project_slug}}/${{flow_setting_identifier}}",
50-
host, addr
46+
let configs = vec![ModuleDefinitionAppendix {
47+
module_identifier: String::from("draco-rest"),
48+
definitions: vec![ModuleDefinition {
49+
flow_type_identifier: vec![String::from("REST")],
50+
value: Some(tucana::shared::module_definition::Value::Endpoint(
51+
Endpoint {
52+
host,
53+
port: addr as i64,
54+
endpoint: String::from(r"/${{project_slug}}${{httpURL}}"),
55+
},
5156
)),
52-
),
57+
}],
5358
}];
5459
match runner.serve(configs).await {
5560
Ok(_) => (),

0 commit comments

Comments
 (0)