From 243b09080605fc55504278e7e1259ddb6977be98 Mon Sep 17 00:00:00 2001 From: noneAuth Date: Mon, 18 Mar 2024 16:56:06 +0800 Subject: [PATCH] feat: add env.json --- client/.umirc.ts | 2 ++ env.json | 3 +++ server/app/service/tugraph/constant.ts | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 env.json diff --git a/client/.umirc.ts b/client/.umirc.ts index de85039d..b5698f94 100644 --- a/client/.umirc.ts +++ b/client/.umirc.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'umi'; import routes from './src/config/routes'; import { GetEnvironmentVariables } from '../server/app/util'; +import env from '../env.json'; process.env.MFSU_AD = 'none'; @@ -50,6 +51,7 @@ export default defineConfig({ 'process.env': { HOST: GetEnvironmentVariables(process.env), ...process.env, + ...env, }, }, }); diff --git a/env.json b/env.json new file mode 100644 index 00000000..4ca88b1e --- /dev/null +++ b/env.json @@ -0,0 +1,3 @@ +{ + "tugraph_db_host": "http://47.105.42.70:9090" +} diff --git a/server/app/service/tugraph/constant.ts b/server/app/service/tugraph/constant.ts index 07aeeec2..5f5a95e5 100644 --- a/server/app/service/tugraph/constant.ts +++ b/server/app/service/tugraph/constant.ts @@ -1,11 +1,11 @@ -import { log } from 'console'; import { GetEnvironmentVariables } from '../../util'; -log(GetEnvironmentVariables(process.env), 'server'); +import env from '../../../../env.json'; const HOST = GetEnvironmentVariables(process.env); + export const HOST_URL = `http://47.105.42.70:9090`; export const DEV_HOST_URL = 'http://127.0.0.1:9090'; export const EngineServerURL = `${ + env?.tugraph_db_host || HOST?.tugraph_db_host || (process.env?.NODE_ENV === 'production' ? DEV_HOST_URL : HOST_URL) }/LGraphHttpService/Query`; -log(EngineServerURL, 'eng');