origin env
This commit is contained in:
+28
-2
@@ -26,8 +26,34 @@ else
|
|||||||
echo "DOCKSHIP_LITE=false" > .env
|
echo "DOCKSHIP_LITE=false" > .env
|
||||||
fi
|
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
|
# Display GitHub OAuth info
|
||||||
BASE_URL="http://localhost:3000"
|
BASE_URL=$ORIGIN
|
||||||
REDIRECT_URL="$BASE_URL/api/auth/callback/github"
|
REDIRECT_URL="$BASE_URL/api/auth/callback/github"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
@@ -73,7 +99,6 @@ After=network.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=$INSTALL_DIR
|
WorkingDirectory=$INSTALL_DIR
|
||||||
# Run Next.js normally (non-standalone)
|
|
||||||
ExecStart=$(which npm) run start
|
ExecStart=$(which npm) run start
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
@@ -97,4 +122,5 @@ echo ""
|
|||||||
echo "DockShip installation complete!"
|
echo "DockShip installation complete!"
|
||||||
echo "You can check logs with: sudo journalctl -u dockship -f"
|
echo "You can check logs with: sudo journalctl -u dockship -f"
|
||||||
echo "Lite Mode: $(grep DOCKSHIP_LITE .env)"
|
echo "Lite Mode: $(grep DOCKSHIP_LITE .env)"
|
||||||
|
echo "Origin: $(grep ORIGIN .env)"
|
||||||
echo "You can edit .env later to update configuration."
|
echo "You can edit .env later to update configuration."
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ export async function GET(request: NextRequest) {
|
|||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const code = searchParams.get("code");
|
const code = searchParams.get("code");
|
||||||
|
|
||||||
console.log(request.url, request.nextUrl);
|
|
||||||
|
|
||||||
if (!code) {
|
if (!code) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: "No code provided" },
|
{ error: "No code provided" },
|
||||||
@@ -40,7 +38,7 @@ export async function GET(request: NextRequest) {
|
|||||||
secure: process.env.NODE_ENV === "production",
|
secure: process.env.NODE_ENV === "production",
|
||||||
});
|
});
|
||||||
|
|
||||||
return NextResponse.redirect(`${request.nextUrl.origin}/overview`);
|
return NextResponse.redirect(`${process.env.ORIGIN}/overview`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
|
|||||||
Reference in New Issue
Block a user