fix: making the script functional

This commit is contained in:
Aditya
2023-10-19 17:33:47 +05:30
parent aad43c913d
commit 7ad4e50c70
+8 -2
View File
@@ -2,12 +2,14 @@
read -p "Are you using Minikube? (yes/no): " is_minikube
default_ip=$(ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print $2}')
if [ "$is_minikube" == "yes" ]; then
node_ip=$(minikube ip)
else
read -p "Enter your node IP (default is localhost): " custom_ip
read -p "Enter your node IP (default is $default_ip): " custom_ip
# Use localhost as the default value
node_ip=${custom_ip:-localhost}
node_ip=${custom_ip:-$default_ip}
fi
echo "Using node IP: $node_ip to generate SSL certs!"
@@ -20,9 +22,13 @@ openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/reg.key -x509 -days 36
# generate a random string
random_string=$(openssl rand -hex 3)
echo "Starting docker registry with name shuffle-local-registry-$random_string.."
docker run -d -p 5000:5000 --restart=always --name "shuffle-local-registry-$random_string" \
-v $(pwd)/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/reg.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/reg.key \
registry:2
echo "Done!"