const express = require('express'); const app = express(); const PORT = process.env.PORT || 3000; // 認証ゲートウェイ(oauth2-proxy)が付与するヘッダーからユーザー情報を取得。 // ローカル開発時(Traefik経由なし)はフォールバック値を使う。 app.use((req, res, next) => { req.authUser = { email: req.headers['x-auth-request-email'] || 'dev-local@next-hd.co.jp', name: req.headers['x-auth-request-user'] || 'dev-local', }; next(); }); app.get('/', (req, res) => { res.send(`

authgw-poc

email: ${req.authUser.email}

name: ${req.authUser.name}

`); }); // Dokploy/Traefikのヘルスチェックが叩くエンドポイント app.get('/health', (req, res) => { res.status(200).json({ status: 'healthy' }); }); app.listen(PORT, () => { console.log(`authgw-poc listening on port ${PORT}`); });