@australiawow/setup-dev-stack 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/setup-dev-stack.sh +13 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@australiawow/setup-dev-stack",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Automated Nginx/SSL/Docker Stack Orchestrator",
5
5
  "main": "setup-dev-stack.sh",
6
6
  "bin": {
@@ -2,7 +2,7 @@
2
2
 
3
3
  # --- Technical Specification ---
4
4
  # Name: setup-dev-stack.sh
5
- # Version: 2.1.0 (Self-Healing Edition)
5
+ # Version: 2.1.1 (Self-Healing Edition)
6
6
  # ----------------------------------------------------------------
7
7
 
8
8
  # MODULE 0: NATIVE DEPENDENCY CHECK (Runs as User)
@@ -51,17 +51,27 @@ fi
51
51
 
52
52
  # MODULE 3: SSL AUTOMATION
53
53
  echo "Step 3/6: Automating SSL Trust..."
54
- # Fact: We must use the REAL_USER path for certs so they are accessible
54
+ # Fact: Capture the real user to ensure paths and permissions match
55
55
  REAL_USER=${SUDO_USER:-$(whoami)}
56
56
  USER_HOME=$(eval echo "~$REAL_USER")
57
57
  CERT_DIR="$USER_HOME/certs/$CLIENT"
58
58
 
59
+ # Action: Create directory and IMMEDIATELY give it to the user
59
60
  mkdir -p "$CERT_DIR"
60
- # Run mkcert as the real user to ensure it touches their local keychain
61
+ chown "$REAL_USER" "$CERT_DIR"
62
+
63
+ # Action: Run mkcert as the real user so it can write to the folder
64
+ echo "Fact: Generating certificates for $DOMAIN..."
61
65
  sudo -u "$REAL_USER" mkcert -install >/dev/null 2>&1
62
66
  sudo -u "$REAL_USER" mkcert -cert-file "$CERT_DIR/cert.pem" -key-file "$CERT_DIR/key.pem" \
63
67
  "$DOMAIN" "*.$DOMAIN" "localhost" "127.0.0.1" >/dev/null 2>&1
64
68
 
69
+ # Verification: Check if files actually exist
70
+ if [ ! -f "$CERT_DIR/cert.pem" ]; then
71
+ echo "Error: SSL Certificate generation failed in $CERT_DIR"
72
+ exit 1
73
+ fi
74
+
65
75
  # MODULE 4: DNS SPOOFING
66
76
  echo "Step 4/6: Updating /etc/hosts..."
67
77
  sed -i '' "/$DOMAIN/d" /etc/hosts