Skip to content

Commit

Permalink
feat: add --provisioner-address arg to both runtimes (#433)
Browse files Browse the repository at this point in the history
* refactor: fix up dependencies

* feat: add --provisioner-address to both runtimes
  • Loading branch information
chesedo authored Oct 26, 2022
1 parent f6e1766 commit e773225
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 25 deletions.
14 changes: 0 additions & 14 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ members = [
"common",
"deployer",
"gateway",
"next",
"proto",
"provisioner",
"service"
Expand Down
5 changes: 3 additions & 2 deletions runtimes/legacy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ async-trait = "0.1.58"
clap ={ version = "4.0.18", features = ["derive"] }
thiserror = "1.0.37"
tokio = { version = "=1.20.1", features = ["full"] }
tonic = "0.8.0"
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }

[dependencies.shuttle-common]
version = "0.7.0"
path = "../common"
path = "../../common"

[dependencies.shuttle-service]
version = "0.7.0"
default-features = false
features = ["loader"]
path = "../service"
path = "../../service"
5 changes: 5 additions & 0 deletions runtimes/legacy/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
use clap::Parser;
use tonic::transport::Endpoint;

#[derive(Parser, Debug)]
pub struct Args {
/// Uri to the `.so` file to load
#[arg(long, short)]
pub file_path: String,

/// Address to reach provisioner at
#[clap(long, default_value = "localhost:5000")]
pub provisioner_address: Endpoint,
}
4 changes: 2 additions & 2 deletions runtimes/legacy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{collections::BTreeMap, net::SocketAddr, path::PathBuf, str::FromStr};
use async_trait::async_trait;
use clap::Parser;
use shuttle_common::{database, LogItem};
use shuttle_next::args::Args;
use shuttle_legacy::args::Args;
use shuttle_service::{
loader::{LoadedService, Loader},
Factory, Logger, ServiceName,
Expand Down Expand Up @@ -59,7 +59,7 @@ async fn load_service(
so_path: PathBuf,
factory: &mut dyn Factory,
logger: Logger,
) -> shuttle_next::error::Result<LoadedService> {
) -> shuttle_legacy::error::Result<LoadedService> {
let loader = Loader::from_so_file(so_path)?;

Ok(loader.load(factory, addr, logger).await?)
Expand Down
5 changes: 3 additions & 2 deletions runtimes/next/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[[bin]]
name = "shuttle-runtime"
name = "shuttle-next"

[dependencies]
async-trait = "0.1.58"

clap ={ version = "4.0.18", features = ["derive"] }
tokio = { version = "1.20.1", features = [ "full" ] }
tonic = "0.8.0"

cap-std = "*"
wasmtime = "*"
Expand Down
9 changes: 9 additions & 0 deletions runtimes/next/src/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use clap::Parser;
use tonic::transport::Endpoint;

#[derive(Parser, Debug)]
pub struct Args {
/// Address to reach provisioner at
#[clap(long, default_value = "localhost:5000")]
pub provisioner_address: Endpoint,
}
2 changes: 2 additions & 0 deletions runtimes/next/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub mod args;

use std::fs::File;
use std::io::{Read, Write};
use std::os::unix::prelude::RawFd;
Expand Down
9 changes: 5 additions & 4 deletions runtimes/next/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use clap::Parser;
use serenity::prelude::*;
use shuttle_next::{args::Args, Bot};
use std::env;
use std::io;

use serenity::prelude::*;

use shuttle_runtime::Bot;

#[tokio::main]
async fn main() -> io::Result<()> {
let _args = Args::parse();

let intents = GatewayIntents::GUILD_MESSAGES | GatewayIntents::MESSAGE_CONTENT;

let token = env::var("DISCORD_TOKEN").unwrap();
Expand Down

0 comments on commit e773225

Please sign in to comment.