diff --git a/config.js b/config.js
index 876c063918..ca7f77c2fd 100644
--- a/config.js
+++ b/config.js
@@ -5,6 +5,8 @@ module.exports = {
ua: process.env.UA || 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
listenInaddrAny: process.env.LISTEN_INADDR_ANY || 1, // 是否允许公网连接,取值 0 1
requestRetry: process.env.REQUEST_RETRY || 2, // 请求失败重试次数
+ // 是否显示 Debug 信息,取值 boolean 'false' 'key' ,取值为 'false' false 时永远不显示,取值为 'key' 时带上 ?debug=key 显示
+ debugInfo: process.env.DEBUG_INFO || true,
redis: {
url: process.env.REDIS_URL || 'redis://localhost:6379/',
options: {
diff --git a/router.js b/router.js
index 19dda79459..2a0a02b563 100644
--- a/router.js
+++ b/router.js
@@ -33,7 +33,15 @@ router.get('/', async (ctx) => {
hotIPsValue += `${ctx.debug.ips[item]} ${item}
`;
});
+ let showDebug;
+ if (!config.debugInfo || config.debugInfo === 'false') {
+ showDebug = false;
+ } else {
+ showDebug = config.debugInfo === true || config.debugInfo === ctx.query.debug;
+ }
+
ctx.body = art(path.resolve(__dirname, './views/welcome.art'), {
+ showDebug,
debug: [
{
name: 'git hash',
diff --git a/views/welcome.art b/views/welcome.art
index 79f3ce8332..a58e934daa 100644
--- a/views/welcome.art
+++ b/views/welcome.art
@@ -87,6 +87,7 @@
DIYgod