Skip to content

Commit

Permalink
fix: try to move kafka to plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 1, 2022
1 parent 1d02ae6 commit 8e4340b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fkl_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ rand = "0.8.5"


#------------------- Message Queue -------------------
kafka = "0.9"
#kafka = "0.9"

[dev-dependencies]
trycmd = "0.14.0"
Expand Down
8 changes: 8 additions & 0 deletions fkl_parser/src/parser/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ pub struct EnvDecl {
pub datasource: Option<DatasourceDecl>,
pub message_broker: Option<MessageBrokerDecl>,
pub server: Option<ServerDecl>,
pub customs: Vec<CustomDecl>,
}

#[derive(Debug, Clone, PartialEq, Eq, Default)]
Expand All @@ -436,3 +437,10 @@ pub struct ServerDecl {
pub port: u16,
pub attributes: Vec<AttributeDefinition>,
}

#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct CustomDecl {
pub name: String,
pub inline_doc: String,
pub attributes: Vec<AttributeDefinition>,
}
23 changes: 23 additions & 0 deletions fkl_parser/src/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,7 @@ env Local {
}),
message_broker: None,
server: None,
customs: vec![]
}));
}

Expand All @@ -1662,9 +1663,31 @@ env Local {
port: 8899,
attributes: vec![]
}),
customs: vec![]
}));
}

#[test]
fn custom_env() {
let decls = parse(r#"
env Local {
kafka {
host: "localhost"
port: 9092
}
}"#).unwrap();

assert_eq!(decls[0], FklDeclaration::Env(EnvDecl {
name: "Local".to_string(),
inline_doc: "".to_string(),
datasource: None,
message_broker: None,
server: None,
customs: vec![]
}));

}

#[test]
fn include_other_file() {
let _decls = parse(r#"include "./layer.rs""#).or_else(|e| {
Expand Down

0 comments on commit 8e4340b

Please sign in to comment.