-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_https.sh
More file actions
executable file
·85 lines (76 loc) · 2.93 KB
/
Copy pathsetup_https.sh
File metadata and controls
executable file
·85 lines (76 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
#
# This script helps set up mkcert for local HTTPS development.
#
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Install mkcert if not already installed
if ! command_exists mkcert; then
echo "🔐 mkcert not found. Attempting to install..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux (Debian/Ubuntu)
if command_exists apt-get; then
sudo apt-get update
sudo apt-get install -y libnss3-tools
# Install mkcert from source
(
cd /tmp || exit
LATEST_VERSION=$(curl -s "https://api.github.com/repos/FiloSottile/mkcert/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [[ -z "$LATEST_VERSION" ]]; then
echo "❌ Could not determine latest mkcert version. Please install manually."
exit 1
fi
echo "⬇️ Downloading mkcert version $LATEST_VERSION..."
curl -Lo mkcert "https://github.com/FiloSottile/mkcert/releases/download/${LATEST_VERSION}/mkcert-${LATEST_VERSION}-linux-amd64"
chmod +x mkcert
sudo mv mkcert /usr/local/bin/
)
else
echo "❌ Unsupported Linux distribution. Please install mkcert manually."
echo " See: https://github.com/FiloSottile/mkcert#installation"
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# MacOS
if command_exists brew; then
brew install mkcert
brew install nss # for Firefox
else
echo "❌ Homebrew not found. Please install mkcert manually."
echo " See: https://github.com/FiloSottile/mkcert#installation"
exit 1
fi
else
echo "❌ Unsupported OS. Please install mkcert manually."
echo " See: https://github.com/FiloSottile/mkcert#installation"
exit 1
fi
# Verify installation
if ! command_exists mkcert; then
echo "❌ mkcert installation failed. Please try installing it manually."
exit 1
fi
fi
echo "✅ mkcert is installed."
# Run mkcert to install the local CA
echo "🔧 Installing local Certificate Authority (CA)..."
mkcert -install
# Generate certificate for localhost
echo "🔑 Generating certificate for localhost..."
mkcert localhost 127.0.0.1
# Rename files to be more generic
mv localhost+1.pem localhost.pem
mv localhost+1-key.pem localhost-key.pem
echo ""
echo "🎉 Success! Certificate and key files created:"
echo " - localhost.pem"
echo " - localhost-key.pem"
echo ""
echo "Next steps:"
echo "1. Update your Google OAuth credentials to use HTTPS:"
echo " - Authorized JavaScript origins: https://localhost:8000"
echo " - Authorized redirect URIs: https://localhost:8000/auth"
echo "2. Run the application with: ./run.sh"
echo "3. Access the app at: https://localhost:8000"