From 5b50319e62fc6aae3e6b1d1879e415dff7d99830 Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Mon, 11 Dec 2023 09:28:38 +0900 Subject: [PATCH] =?UTF-8?q?env=E3=81=8B=E3=82=89=E3=81=A7=E3=81=AA?= =?UTF-8?q?=E3=81=8F=E3=80=81config=E3=81=8B=E3=82=89=E5=90=84=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E5=80=A4=E3=82=92=E5=8F=96=E3=82=8A=E8=BE=BC=E3=82=80?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mypage/lib.ts | 11 +++++------ src/mypage/メール.ts | 2 +- types/env.d.ts | 5 ----- webpack.config.js | 2 -- 4 files changed, 6 insertions(+), 14 deletions(-) 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')), - }), ], };