@@ -2,7 +2,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Create runtime env-config.js for the static app
|
# Create runtime env-config.js for the static app
|
||||||
cat > /usr/share/nginx/html/env-config.js <<'EOF'
|
cat > /usr/share/nginx/html/env-config.js <<EOF
|
||||||
window.__ENV__ = {
|
window.__ENV__ = {
|
||||||
VITE_AUTH_API: "${VITE_AUTH_API:-http://localhost:5000}",
|
VITE_AUTH_API: "${VITE_AUTH_API:-http://localhost:5000}",
|
||||||
VITE_TRANSIT_API: "${VITE_TRANSIT_API:-http://localhost:5001}"
|
VITE_TRANSIT_API: "${VITE_TRANSIT_API:-http://localhost:5001}"
|
||||||
|
|||||||
+4
-10
@@ -55,16 +55,10 @@ app.get('/me', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Development helper: issue a token without DB checks when DEV_BYPASS=1
|
// Development helper removed for production safety.
|
||||||
if (process.env.DEV_BYPASS === '1') {
|
// The /dev/token endpoint was intentionally removed to prevent accidental
|
||||||
app.post('/dev/token', (req, res) => {
|
// issuance of tokens in production builds. Use the real authentication flow
|
||||||
const { userId, userCode } = req.body || {};
|
// (POST /login) or re-enable this code only in local development branches.
|
||||||
if (!userId || !userCode) return res.status(400).json({ error: 'userId and userCode required' });
|
|
||||||
const payload = { userId: Number(userId), userCode: Number(userCode) };
|
|
||||||
const token = jwt.sign(payload, JWT_SECRET || 'devsecret', { expiresIn: '7d' });
|
|
||||||
res.json({ token, user: payload });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 5000;
|
const PORT = process.env.PORT || 5000;
|
||||||
app.listen(PORT, () => console.log(`Auth API listening on ${PORT}`));
|
app.listen(PORT, () => console.log(`Auth API listening on ${PORT}`));
|
||||||
|
|||||||
+2
-2
@@ -54,8 +54,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "5174:80"
|
- "5174:80"
|
||||||
environment:
|
environment:
|
||||||
VITE_AUTH_API: http://auth_api:5000
|
VITE_AUTH_API: http://192.168.2.66:5000
|
||||||
VITE_TRANSIT_API: http://transit_api:5001
|
VITE_TRANSIT_API: http://192.168.2.66:5001
|
||||||
depends_on:
|
depends_on:
|
||||||
- auth_api
|
- auth_api
|
||||||
- transit_api
|
- transit_api
|
||||||
|
|||||||
Reference in New Issue
Block a user