260121_01_ENH : client env 정규화 및 로그인 페이지 오류 수정
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
export const clientEnv = {
|
||||
ENV: process.env.NEXT_PUBLIC_ENV as string,
|
||||
API_BASE: process.env.NEXT_PUBLIC_API_BASE as string,
|
||||
STORE_KEY: process.env.NEXT_PUBLIC_STORE_KEY as string,
|
||||
// 다른 클라이언트 전용 env들 추가 가능
|
||||
const required = <K extends keyof typeof RAW_PUBLIC_ENV>(name: K) => {
|
||||
const v = RAW_PUBLIC_ENV[name];
|
||||
if (!v) throw new Error(`Missing env: ${name}`);
|
||||
return v;
|
||||
};
|
||||
if (!clientEnv.ENV) {
|
||||
throw new Error("Missing env: NEXT_PUBLIC_ENV");
|
||||
}
|
||||
|
||||
if (!clientEnv.API_BASE) {
|
||||
throw new Error("Missing env: NEXT_PUBLIC_API_BASE");
|
||||
}
|
||||
const RAW_PUBLIC_ENV = {
|
||||
NEXT_PUBLIC_ENV: process.env.NEXT_PUBLIC_ENV,
|
||||
NEXT_PUBLIC_API_BASE: process.env.NEXT_PUBLIC_API_BASE,
|
||||
NEXT_PUBLIC_STORE_KEY: process.env.NEXT_PUBLIC_STORE_KEY,
|
||||
} as const;
|
||||
|
||||
if (!clientEnv.STORE_KEY) {
|
||||
throw new Error("Missing env: NEXT_PUBLIC_STORE_KEY");
|
||||
}
|
||||
export const clientEnv = {
|
||||
ENV: required("NEXT_PUBLIC_ENV"),
|
||||
API_BASE: required("NEXT_PUBLIC_API_BASE"),
|
||||
STORE_KEY: required("NEXT_PUBLIC_STORE_KEY"),
|
||||
};
|
||||
Reference in New Issue
Block a user