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= ADDITIONAL_SOFTWARE=
# (DEF) Either prepare --target triple-x-y OR have an empty value # (DEF) Either prepare --target triple-x-y OR have an empty value
TARGET_ARG = TARGET_ARG =
@ -141,7 +142,7 @@ stress: .release-server
@echo "Stress testing (all)" @echo "Stress testing (all)"
@echo "====================================================================" @echo "===================================================================="
@$(STOP_SERVER) @$(STOP_SERVER)
@rm -f .sky_pid cert.pem key.pem server/cert.pem @rm -f .sky_pid cert.pem key.pem
bundle: release bundle: release
@echo "====================================================================" @echo "===================================================================="
@echo "Creating bundle for platform" @echo "Creating bundle for platform"

@ -6,4 +6,3 @@ function gen_sub() {
echo "$result" 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 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 { mod ssl {
use skytable::aio::TlsConnection; use skytable::aio::TlsConnection;
use skytable::{Element, Query, Response}; use skytable::{Element, Query, Response};
use std::env;
#[tokio::test] #[tokio::test]
async fn test_ssl() { async fn test_ssl() {
let mut con = TlsConnection::new("127.0.0.1", 2004, "cert.pem") let mut path = env::var("ROOT_DIR").expect("ROOT_DIR unset");
.await path.push_str("/cert.pem");
.unwrap(); let mut con = TlsConnection::new("127.0.0.1", 2004, &path).await.unwrap();
let q = Query::from("heya"); let q = Query::from("heya");
assert_eq!( assert_eq!(
con.run_simple_query(&q).await.unwrap(), con.run_simple_query(&q).await.unwrap(),

Loading…
Cancel
Save