Use env var to determine TLS cert location

next
Sayan Nandan 3 years ago
parent bca37ede43
commit 141e39eee1

@ -1,3 +1,4 @@
export ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
ADDITIONAL_SOFTWARE=
# (DEF) Either prepare --target triple-x-y OR have an empty value
TARGET_ARG =
@ -141,7 +142,7 @@ stress: .release-server
@echo "Stress testing (all)"
@echo "===================================================================="
@$(STOP_SERVER)
@rm -f .sky_pid cert.pem key.pem server/cert.pem
@rm -f .sky_pid cert.pem key.pem
bundle: release
@echo "===================================================================="
@echo "Creating bundle for platform"

@ -6,4 +6,3 @@ function gen_sub() {
echo "$result"
}
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj $(gen_sub '/C=US/CN=example.com') -keyout key.pem -out cert.pem
cp cert.pem $PWD/server/cert.pem

@ -98,11 +98,12 @@ mod bgsave {
mod ssl {
use skytable::aio::TlsConnection;
use skytable::{Element, Query, Response};
use std::env;
#[tokio::test]
async fn test_ssl() {
let mut con = TlsConnection::new("127.0.0.1", 2004, "cert.pem")
.await
.unwrap();
let mut path = env::var("ROOT_DIR").expect("ROOT_DIR unset");
path.push_str("/cert.pem");
let mut con = TlsConnection::new("127.0.0.1", 2004, &path).await.unwrap();
let q = Query::from("heya");
assert_eq!(
con.run_simple_query(&q).await.unwrap(),

Loading…
Cancel
Save