Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ENVIRONMENT='development'
MODE='dynamic'
RABBITMQ_URL='amqp://localhost:5672'
AQUILA_URL='http://localhost:8080'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ target
.DS_Store
./out
out

.env
156 changes: 150 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "taurus"
version = "0.1.0"
edition = "2021"
edition = "2024"

[dependencies]
code0-flow = { version = "0.0.12", features = ["all"] }
code0-flow = { version = "0.0.13" }
tucana = { version = "0.0.28", features = ["aquila"] }
lapin = "2.5.3"
serde = "1.0.219"
Expand All @@ -13,6 +13,7 @@ tokio = { version = "1.44.1", features = ["rt-multi-thread"] }
toml = "0.8.0"
log = "0.4.27"
futures-lite = "2.6.0"
env_logger = "0.11.8"

[dev-dependencies]
tempfile = "3.19.1"
38 changes: 38 additions & 0 deletions src/configuration.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use code0_flow::flow_config::{env_with_default, environment::Environment, mode::Mode};

/// Struct for all relevant `Taurus` startup configurations
pub struct Config {
/// Options:
/// `development` (default)
/// `staging`
/// `production`
pub environment: Environment,

/// Aquila mode
///
/// Options:
/// `static` (default)
/// `hybrid`
pub mode: Mode,

/// Verification Token required for internal communication
pub rabbitmq_url: String,

/// URL to the `Sagittarius` Server.
pub aquila_url: String,
}

/// Implementation for all relevant `Aquila` startup configurations
///
/// Behavior:
/// Searches for the env. file at root level. Filename: `.env`
impl Config {
pub fn new() -> Self {
Config {
environment: env_with_default("ENVIRONMENT", Environment::Development),
mode: env_with_default("MODE", Mode::STATIC),
rabbitmq_url: env_with_default("RABBITMQ_URL", String::from("amqp://localhost:5672")),
aquila_url: env_with_default("AQUILA_URL", String::from("http://localhost:8080")),
}
}
}
19 changes: 16 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
mod configuration;
pub mod context;
pub mod error;
pub mod implementation;
pub mod locale;
pub mod registry;

use std::sync::Arc;

use code0_flow::flow_queue::service::{Message, RabbitmqClient};
use code0_flow::{
flow_config::load_env_file,
flow_queue::service::{Message, RabbitmqClient},
};
use context::{Context, ContextEntry, ContextResult};
use error::RuntimeError;
use futures_lite::StreamExt;
Expand All @@ -15,6 +18,8 @@ use locale::locale::Locale;
use registry::FunctionStore;
use tucana::shared::{Flow, NodeFunction, Value};

use crate::configuration::Config;

fn handle_node_function(
function: NodeFunction,
store: &FunctionStore,
Expand Down Expand Up @@ -165,10 +170,18 @@ fn handle_message(message: Message, store: &FunctionStore) -> Result<Message, la

#[tokio::main]
async fn main() {
env_logger::Builder::from_default_env()
.filter_level(log::LevelFilter::Debug)
.init();

load_env_file();

let config = Config::new();

let _locale = Locale::default();
let store = FunctionStore::new();

let rabbitmq_client = Arc::new(RabbitmqClient::new("amqp://localhost:5672").await);
let rabbitmq_client = Arc::new(RabbitmqClient::new(config.rabbitmq_url.as_str()).await);

let mut consumer = {
let channel = rabbitmq_client.channel.lock().await;
Expand Down