-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: split off start command * refactor: move migration to main * feat: init command * refactor: clap 4 convention * refactor: StartArgs
- Loading branch information
Showing
5 changed files
with
135 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,55 @@ | ||
use std::net::SocketAddr; | ||
|
||
use clap::Parser; | ||
use clap::{Parser, Subcommand}; | ||
|
||
#[derive(Parser, Debug, Clone)] | ||
use crate::auth::Key; | ||
|
||
#[derive(Parser, Debug)] | ||
pub struct Args { | ||
/// Uri to the `.sqlite` file used to store state | ||
#[arg(long, default_value = "./gateway.sqlite")] | ||
pub state: String, | ||
|
||
#[command(subcommand)] | ||
pub command: Commands, | ||
} | ||
|
||
#[derive(Subcommand, Debug)] | ||
pub enum Commands { | ||
Start(StartArgs), | ||
Init(InitArgs), | ||
} | ||
|
||
#[derive(clap::Args, Debug, Clone)] | ||
pub struct StartArgs { | ||
/// Address to bind the control plane to | ||
#[clap(long, default_value = "127.0.0.1:8001")] | ||
#[arg(long, default_value = "127.0.0.1:8001")] | ||
pub control: SocketAddr, | ||
/// Address to bind the user plane to | ||
#[clap(long, default_value = "127.0.0.1:8000")] | ||
#[arg(long, default_value = "127.0.0.1:8000")] | ||
pub user: SocketAddr, | ||
/// Default image to deploy user runtimes into | ||
#[clap(long, default_value = "public.ecr.aws/shuttle/deployer:latest")] | ||
#[arg(long, default_value = "public.ecr.aws/shuttle/deployer:latest")] | ||
pub image: String, | ||
/// Prefix to add to the name of all docker resources managed by | ||
/// this service | ||
#[clap(long, default_value = "shuttle_prod_")] | ||
#[arg(long, default_value = "shuttle_prod_")] | ||
pub prefix: String, | ||
/// The address at which an active runtime container will find | ||
/// the provisioner service | ||
#[clap(long, default_value = "provisioner")] | ||
#[arg(long, default_value = "provisioner")] | ||
pub provisioner_host: String, | ||
/// The Docker Network name in which to deploy user runtimes | ||
#[clap(long, default_value = "shuttle_default")] | ||
#[arg(long, default_value = "shuttle_default")] | ||
pub network_name: String, | ||
/// Uri to the `.sqlite` file used to store state | ||
#[clap(long, default_value = "./gateway.sqlite")] | ||
pub state: String, | ||
} | ||
|
||
#[derive(clap::Args, Debug, Clone)] | ||
pub struct InitArgs { | ||
/// Name of initial account to create | ||
#[arg(long)] | ||
pub name: String, | ||
/// Key to assign to initial account | ||
#[arg(long)] | ||
pub key: Option<Key>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters