actix / examples

Community showcase and examples of Actix Web ecosystem usage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[improvement] running rustls-server from workspace panics

opened this issue · comments

As a cargo user, I expect to be able to run packages from a cargo workspace.

  1. I ran:
cargo run  --bin rustls-server

It errored with:

   Running `target/debug/rustls-server`
Started http server: 127.0.0.1:8443
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', security/rustls/src/main.rs:28:64

improvement guide

The following lines load the key pair:

let cert_file = &mut BufReader::new(File::open("cert.pem").unwrap());
let key_file = &mut BufReader::new(File::open("key.pem").unwrap());

They expect the key files to be in the current directory but they are not.
An improvement would be to resolve those files dynamically.
Consider updating those lines to avoid using unwrap too.