diff --git a/src/mypage/lib.ts b/src/mypage/lib.ts index a83a7a2..ec276eb 100644 --- a/src/mypage/lib.ts +++ b/src/mypage/lib.ts @@ -1,22 +1,21 @@ +import { myPageConfig } from "@/config/mypage"; import { MyPageApiID } from "."; type MyPageApiResponse = { result: "SUCCESS" | "FAILED"; }; +const config = myPageConfig(); + export const getUrl = (apiId: MyPageApiID) => { - return [ - process.env.VAR.MYPAGE_BASE_URL ?? "", - "api-from-kintone", - apiId, - ].join("/"); + return [config.BASE_URL, "api-from-kintone", apiId].join("/"); }; export const send = async (apiId: MyPageApiID, data: object) => { const url = getUrl(apiId); const sendData = { ...data, - token: process.env.VAR.MYPAGE_TOKEN ?? "", + token: config.TOKEN ?? "", }; console.info("MyPageAPICall", url, data); diff --git a/src/mypage/メール.ts b/src/mypage/メール.ts index 123fdbe..86bd314 100644 --- a/src/mypage/メール.ts +++ b/src/mypage/メール.ts @@ -1,3 +1,4 @@ +import { myPageConfig } from "@/config/mypage"; import { MyPageApiID } from "."; import { send } from "./lib"; @@ -31,7 +32,6 @@ export const sendEmail = ( email_id: id, ...(data ?? {}), ...key, - token: process.env.MYPAGE_TOKEN ?? "", }; return send(MyPageApiID.メール送信依頼, sendData); }; diff --git a/types/env.d.ts b/types/env.d.ts index 7fdbde1..3236373 100644 --- a/types/env.d.ts +++ b/types/env.d.ts @@ -2,11 +2,6 @@ declare global { namespace NodeJS { interface ProcessEnv { NODE_ENV: "development" | "production" | "test"; - // 他の環境変数も追加できます - VAR: { - MYPAGE_BASE_URL: string; - MYPAGE_TOKEN: string; - }; BUILD_TIME: string; } } diff --git a/webpack.config.js b/webpack.config.js index f9588df..0a6aec4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -105,9 +105,7 @@ module.exports = { }, }, new webpack.DefinePlugin({ - 'process.env.VAR': JSON.stringify(env), 'process.env.BUILD_TIME': JSON.stringify(format(new Date(), 'yyyy-MM-dd HH:mm:ss')), - }), ], };