Commit 9decf790 authored by 郭志伟's avatar 郭志伟

build(apollo): 调整apollo配置

parent dbee52d7
......@@ -3,23 +3,22 @@ export default class ActivityController extends Controller {
public async home(ctx: Context) {
// 开发环境不走redis缓存
const apollo = ctx.app.config.apollo || {};
let body = '';
if (process.env.NODE_ENV === 'development') {
ctx.body = await ctx.renderToHtml('activity.js', { url: ctx.url });
return;
}
const redisKey = `quantum-blocks:page:${ctx.params.id}`;
let body = await ctx.service.redis.get(redisKey);
if (body) {
ctx.logger.info('请求redis成功 key: %j', redisKey);
}
if (!body) {
let apollo = {};
if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') {
apollo = ctx.app.config.apollo || {};
}
body = await ctx.renderToHtml('activity.js', { url: ctx.url, apollo });
await ctx.service.redis.set(redisKey, body);
} else {
const redisKey = `quantum-blocks:page:${ctx.params.id}`;
body = await ctx.service.redis.get(redisKey);
if (body) {
ctx.logger.info('请求redis成功 key: %j', redisKey);
}
if (!body) {
body = await ctx.renderToHtml('activity.js', { url: ctx.url, apollo });
await ctx.service.redis.set(redisKey, body);
}
}
ctx.body = body;
}
}
......@@ -2,10 +2,10 @@ import apolloSsr from '../../../config/apollo.ssr.json';
const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https';
const hostMap = {
apiHost: `${protocol}//quantum-blocks-vcc3.liangkebang.net`,
kdspHost: `${protocol}//talos-vcc3.liangkebang.net`,
apiHost: `${protocol}//quantum-blocks-tob.liangkebang.net`,
kdspHost: `${protocol}//talos-tob.liangkebang.net`,
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`,
mallHost: `${protocol}://mall-vcc3.liangkebang.net`,
mallHost: `${protocol}://mall-tob.liangkebang.net`,
test: true,
yxmTenantId: 560761,
appIdMap: {
......
......@@ -4,7 +4,6 @@ import Storage from '@/service/localStorage.service';
import { getParameterByName, isWxMp, isApp } from '@/service/utils.service';
export function initSa(router) {
if (process.env.NODE_ENV === 'development') { return; }
const sa = require('sa-sdk-javascript');
const activityId = window.location.pathname.split('/')?.[2] || '';
const vccChannel = getParameterByName('vccChannel') || getParameterByName('registerFrom');
......@@ -19,7 +18,7 @@ export function initSa(router) {
},
// 判断外层是否有 App 的 SDK ,如果有的话,会往 App 的 SDK 发数据。如果没有,就正常发送数据。
use_app_track: true,
show_log: config.test,
show_log: process.env.NODE_ENV !== 'development' && config.test,
app_js_bridge: true,
batch_send: true,
});
......
......@@ -8,20 +8,24 @@
"loginUrl": "",
"mallHost": "https://mall-vcc3.liangkebang.net",
"h5ShopHost": "https://tenet-vcc3.liangkebang.net/#",
"yxmTenantId": 560761
"yxmTenantId": 560761,
"appIdMap": {
"560761": "wxe16bf9293671506c",
"560867": "wxccb8435d68e8c7d6"
}
},
"mysql": {
"low_code": {
"host": "172.17.5.17",
"port": "31548",
"host": "172.17.5.36",
"port": "30983",
"username": "qa",
"password": "qatest",
"database": "low_code"
}
},
"redis": {
"port": "172.17.5.14",
"host": "31226",
"port": "31543",
"host": "172.17.5.14",
"password": "",
"db": 0
},
......
......@@ -9,5 +9,9 @@
"h5ShopHost": "https://tenet-vcc3.liangkebang.net/#",
"qiniuUpHost": "https://up-z0.qiniup.com",
"qiniuHost": "https://appsync.lkbang.net",
"yxmTenantId": 560761
"yxmTenantId": 560761,
"appIdMap": {
"560761": "wxe16bf9293671506c",
"560867": "wxccb8435d68e8c7d6"
}
}
......@@ -2,6 +2,7 @@ import { EggAppConfig } from 'egg';
import * as fs from 'fs';
import * as path from 'path';
import wxVertify from './wxVertify';
const { redis, api, qiniu } = require(path.resolve(__dirname, './apollo.json'));
export default (appInfo: EggAppConfig) => {
const config: any = {};
......@@ -48,5 +49,11 @@ export default (appInfo: EggAppConfig) => {
enable: false
}
};
config.redis = {
client: redis
};
config.apollo = {
...api, ...qiniu
};
return config;
};
......@@ -27,14 +27,6 @@ export default (appInfo: EggAppConfig) => {
browser: 'http://localhost:7001/'
};
exports.redis = {
client: {
port: 31226, // Redis port
host: '172.17.5.14', // Redis host
password: '',
db: 0
}
};
return exports;
};
......@@ -3,7 +3,6 @@
*
* prod + default(override)
*/
import { Application, EggAppConfig } from 'egg';
export default (appInfo: EggAppConfig) => {
......@@ -13,14 +12,5 @@ export default (appInfo: EggAppConfig) => {
dir: '/home/quant_group/logs',
};
exports.redis = {
client: {
port: 6379, // Redis port
host: 'front-redis.quantgroups.com', // Redis host
password: 'ln4^ESq80j4nrTMZ',
db: 0
}
};
return {...exports, apollo: {}};
return exports;
};
import { Application, EggAppConfig } from 'egg';
const path = require('path');
const { redis, api, qiniu } = require(path.resolve(__dirname, './apollo.json'));
export default (appInfo: EggAppConfig) => {
const exports: any = {};
exports.logger = {
dir: '/home/quant_group/logs',
};
exports.redis = {
client: redis
};
return {...exports, apollo: { ...api, ...qiniu }};
return exports;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment