Initial commit: AI platform app (server, views, lib, data, deploy docs)
Made-with: Cursor
This commit is contained in:
35
lib/ops-state.js
Normal file
35
lib/ops-state.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* OPS_STATE: DEV(개발), PROD(운영·임직원 이메일 로그인), SUPER(데모·제한 완화).
|
||||
* 과거 값 REAL 은 PROD 와 동일하게 처리합니다.
|
||||
*/
|
||||
function normalizeOpsState() {
|
||||
const raw = (process.env.OPS_STATE || "DEV").trim().toUpperCase();
|
||||
if (raw === "REAL") return "PROD";
|
||||
if (raw === "DEV" || raw === "PROD" || raw === "SUPER") return raw;
|
||||
return "DEV";
|
||||
}
|
||||
|
||||
function isOpsStateDev() {
|
||||
return normalizeOpsState() === "DEV";
|
||||
}
|
||||
|
||||
function isOpsStateProd() {
|
||||
return normalizeOpsState() === "PROD";
|
||||
}
|
||||
|
||||
function isOpsStateSuper() {
|
||||
return normalizeOpsState() === "SUPER";
|
||||
}
|
||||
|
||||
/** 임직원 이메일(@xavis.co.kr) 매직 링크 로그인을 강제하는 모드 (REAL 구 값 포함) */
|
||||
function isOpsProdMode() {
|
||||
return isOpsStateProd();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
normalizeOpsState,
|
||||
isOpsStateDev,
|
||||
isOpsStateProd,
|
||||
isOpsStateSuper,
|
||||
isOpsProdMode,
|
||||
};
|
||||
Reference in New Issue
Block a user