Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing accept server license terms arg in service install #177366

Merged
merged 2 commits into from
Mar 16, 2023
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
9 changes: 8 additions & 1 deletion cli/src/commands/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ pub enum TunnelSubcommand {
#[derive(Subcommand, Debug, Clone)]
pub enum TunnelServiceSubCommands {
/// Installs or re-installs the tunnel service on the machine.
Install,
Install(TunnelServiceInstallArgs),

/// Uninstalls and stops the tunnel service.
Uninstall,
Expand All @@ -660,6 +660,13 @@ pub enum TunnelServiceSubCommands {
InternalRun,
}

#[derive(Args, Debug, Clone)]
pub struct TunnelServiceInstallArgs {
/// If set, the user accepts the server license terms and the server will be started without a user prompt.
#[clap(long)]
pub accept_server_license_terms: bool,
}

#[derive(Args, Debug, Clone)]
pub struct TunnelRenameArgs {
/// The name you'd like to rename your machine to.
Expand Down
11 changes: 4 additions & 7 deletions cli/src/commands/tunnels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ pub async fn service(
) -> Result<i32, AnyError> {
let manager = create_service_manager(ctx.log.clone(), &ctx.paths);
match service_args {
TunnelServiceSubCommands::Install => {
TunnelServiceSubCommands::Install(args) => {
// ensure logged in, otherwise subsequent serving will fail
Auth::new(&ctx.paths, ctx.log.clone())
.get_credential()
.await?;

// likewise for license consent
legal::require_consent(&ctx.paths, false)?;
legal::require_consent(&ctx.paths, args.accept_server_license_terms)?;

let current_exe =
std::env::current_exe().map_err(|e| wrap(e, "could not get current exe"))?;
Expand Down Expand Up @@ -377,11 +377,8 @@ async fn serve_with_csa(
let tunnel = if let Some(d) = gateway_args.tunnel.clone().into() {
dt.start_existing_tunnel(d).await
} else {
dt.start_new_launcher_tunnel(
gateway_args.name.as_deref(),
gateway_args.random_name,
)
.await
dt.start_new_launcher_tunnel(gateway_args.name.as_deref(), gateway_args.random_name)
.await
}?;

csa.connection_token = Some(get_connection_token(&tunnel));
Expand Down