origin env

This commit is contained in:
2026-02-14 15:53:01 +01:00
parent b62661ccd8
commit 32fd259ae2
2 changed files with 29 additions and 5 deletions
+28 -2
View File
@@ -26,8 +26,34 @@ else
echo "DOCKSHIP_LITE=false" > .env
fi
# Prompt for ORIGIN type
echo ""
echo "Choose the origin IP for DockShip:"
echo "1) Local IP (Recommended)"
echo "2) Public IP (Unsafe)"
read -p "Enter choice [1/2]: " ip_choice
PORT=3000 # Default port
if [[ "$ip_choice" == "1" ]]; then
# Get local IP (first non-loopback IP)
LOCAL_IP=$(hostname -I | awk '{print $1}')
ORIGIN="http://$LOCAL_IP:$PORT"
elif [[ "$ip_choice" == "2" ]]; then
# Get public IP via external service
PUBLIC_IP=$(curl -s https://api.ipify.org)
ORIGIN="http://$PUBLIC_IP:$PORT"
else
echo "\x1b[31mInvalid choice. Exiting.\x1b[0m"
exit 1
fi
# Append ORIGIN to .env
echo "ORIGIN=$ORIGIN" >> .env
echo "Set ORIGIN to $ORIGIN"
# Display GitHub OAuth info
BASE_URL="http://localhost:3000"
BASE_URL=$ORIGIN
REDIRECT_URL="$BASE_URL/api/auth/callback/github"
echo ""
@@ -73,7 +99,6 @@ After=network.target
[Service]
Type=simple
WorkingDirectory=$INSTALL_DIR
# Run Next.js normally (non-standalone)
ExecStart=$(which npm) run start
Restart=always
RestartSec=5
@@ -97,4 +122,5 @@ echo ""
echo "DockShip installation complete!"
echo "You can check logs with: sudo journalctl -u dockship -f"
echo "Lite Mode: $(grep DOCKSHIP_LITE .env)"
echo "Origin: $(grep ORIGIN .env)"
echo "You can edit .env later to update configuration."
+1 -3
View File
@@ -7,8 +7,6 @@ export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const code = searchParams.get("code");
console.log(request.url, request.nextUrl);
if (!code) {
return NextResponse.json(
{ error: "No code provided" },
@@ -40,7 +38,7 @@ export async function GET(request: NextRequest) {
secure: process.env.NODE_ENV === "production",
});
return NextResponse.redirect(`${request.nextUrl.origin}/overview`);
return NextResponse.redirect(`${process.env.ORIGIN}/overview`);
} catch (error) {
console.log(error);
return NextResponse.json(