mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-26 12:21:23 +00:00
added https support
This commit is contained in:
41
utils/local-proxy/test/e2e/https/test_https.sh
Normal file
41
utils/local-proxy/test/e2e/https/test_https.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pushd $(dirname $0) > /dev/null
|
||||
|
||||
echo Creating self-signed certificate
|
||||
|
||||
# Create a self-signed certificate
|
||||
|
||||
export CERT_SECRET=$(openssl rand -base64 20)
|
||||
openssl genrsa 2048 > host.key
|
||||
chmod 400 host.key
|
||||
#openssl req -new -x509 -nodes -sha256 -days 365 -key host.key -out host.cert --passin env:CERT_SECRET -subj "/C=US/ST=WA/L=BELLEVUE/O=Microsoft/OU=Azure Cosmos DB/CN=CHRIS ANDERSON/emailAddress=andersonc@microsoft.com"
|
||||
openssl pkcs12 -export -out host.pfx -inkey host.key -in host.cert --passout env:CERT_SECRET --name "CHRIS ANDERSON"
|
||||
|
||||
export CERT_PATH=$(realpath host.pfx)
|
||||
|
||||
echo CERT_PATH=$CERT_PATH
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
export GATEWAY_TLS_ENABLED=true
|
||||
export EXPLORER_PORT=12345
|
||||
|
||||
# Use node to start so we can kill it later
|
||||
node main.js > ./https-test.log &
|
||||
node_pid=$!
|
||||
echo node pid=$node_pid
|
||||
|
||||
sleep .5
|
||||
|
||||
output=$(curl --insecure -s "https://localhost:12345/_ready")
|
||||
|
||||
kill -KILL $node_pid
|
||||
|
||||
if [ "$output" != "Compilation complete." ]; then
|
||||
echo "Failed to start HTTPS server"
|
||||
cat ./https-test.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo https test completed
|
||||
Reference in New Issue
Block a user