FIX: TLS options
This commit is contained in:
@@ -10,8 +10,8 @@ use furumi_client_core::FurumiClient;
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about = "Furumi-ng: mount remote filesystem via encrypted gRPC + FUSE")]
|
||||
struct Args {
|
||||
/// Server address (use https:// for encrypted, http:// for plaintext)
|
||||
#[arg(short, long, env = "FURUMI_SERVER", default_value = "https://0.0.0.0:50051")]
|
||||
/// Server address (IP:PORT, will use https:// by default unless --no-tls is specified)
|
||||
#[arg(short, long, env = "FURUMI_SERVER", default_value = "0.0.0.0:50051")]
|
||||
server: String,
|
||||
|
||||
/// Authentication Bearer token (leave empty if auth is disabled on server)
|
||||
@@ -21,6 +21,10 @@ struct Args {
|
||||
/// Mount point directory
|
||||
#[arg(short, long, env = "FURUMI_MOUNT")]
|
||||
mount: PathBuf,
|
||||
|
||||
/// Disable TLS encryption
|
||||
#[arg(long, default_value_t = false)]
|
||||
no_tls: bool,
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -38,8 +42,22 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.enable_all()
|
||||
.build()?;
|
||||
|
||||
let full_addr = if args.no_tls {
|
||||
if args.server.starts_with("http://") || args.server.starts_with("https://") {
|
||||
args.server.clone()
|
||||
} else {
|
||||
format!("http://{}", args.server)
|
||||
}
|
||||
} else {
|
||||
if args.server.starts_with("http://") || args.server.starts_with("https://") {
|
||||
args.server.clone()
|
||||
} else {
|
||||
format!("https://{}", args.server)
|
||||
}
|
||||
};
|
||||
|
||||
let client = rt.block_on(async {
|
||||
FurumiClient::connect(&args.server, &args.token).await
|
||||
FurumiClient::connect(&full_addr, &args.token).await
|
||||
})?;
|
||||
|
||||
let fuse_fs = fs::FurumiFuse::new(client, rt.handle().clone());
|
||||
|
||||
Reference in New Issue
Block a user