Skip to content

Commit

Permalink
chore: ec2 환경
Browse files Browse the repository at this point in the history
  • Loading branch information
webplusangels committed Jan 7, 2025
1 parent 8dd3d8c commit 43ff76d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ const postRoutes = require('./routes/postRoutes');
const commentRoutes = require('./routes/commentRoutes');
const uploadRoutes = require('./routes/uploadRoutes');

dotenv.config();
const APP_ENV = process.env.APP_ENV || 'development';

if (APP_ENV === 'development') {
dotenv.config(); // 로컬에서는 .env 파일 사용
}

const app = express();
const PORT = process.env.PORT || 8000;
if (
!process.env.COOKIE_SECRET ||
!process.env.DB_HOST ||
!process.env.DB_USER
) {
console.error('환경 변수 설정이 올바르지 않습니다. 서버를 종료합니다.');
process.exit(1);
}

// 미들웨어 설정
app.use(express.json());
Expand Down

0 comments on commit 43ff76d

Please sign in to comment.