You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/09/27 02:40:51 UTC
[apisix-dashboard] branch master updated: fix: add a config item
APISIX_DEBUG_URL to support online debug (#514)
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 623c6d6 fix: add a config item APISIX_DEBUG_URL to support online debug (#514)
623c6d6 is described below
commit 623c6d6983e3e57d707998e4da4fff4af597708e
Author: liuxiran <be...@126.com>
AuthorDate: Sun Sep 27 10:40:41 2020 +0800
fix: add a config item APISIX_DEBUG_URL to support online debug (#514)
---
api/build.sh | 1 +
api/conf/conf.go | 2 ++
api/conf/conf.json | 3 ++-
api/conf/conf_preview.json | 3 ++-
api/route/route.go | 2 +-
api/run/run.sh | 4 ++++
api/service/consumer.go | 2 +-
compose/manager_conf/build.sh | 2 ++
src/pages/Route/transform.ts | 4 ----
9 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/api/build.sh b/api/build.sh
index cd70490..c734047 100644
--- a/api/build.sh
+++ b/api/build.sh
@@ -25,6 +25,7 @@ sed -i -e "s%#mysqlPWD#%`echo $MYSQL_PASSWORD`%g" ${pwd}/conf.json
sed -i -e "s%#syslogAddress#%`echo $SYSLOG_HOST`%g" ${pwd}/conf.json
sed -i -e "s%#apisixBaseUrl#%`echo $APISIX_BASE_URL`%g" ${pwd}/conf.json
sed -i -e "s%#apisixApiKey#%`echo $APISIX_API_KEY`%g" ${pwd}/conf.json
+sed -i -e "s%#apisixDebugUrl#%`echo $APISIX_DEBUG_URL`%g" ${pwd}/conf.json
cd /go/manager-api
exec ./manager-api
diff --git a/api/conf/conf.go b/api/conf/conf.go
index cbd7f8e..b6e0f4d 100644
--- a/api/conf/conf.go
+++ b/api/conf/conf.go
@@ -39,6 +39,7 @@ var (
basePath string
ApiKey = "edd1c9f034335f136f87ad84b625c8f1"
BaseUrl = "http://127.0.0.1:9080/apisix/admin"
+ DebugUrl = "http://127.0.0.1:9080/"
)
func init() {
@@ -117,6 +118,7 @@ func initApisix() {
apisixConf := configuration.Get("conf.apisix")
BaseUrl = apisixConf.Get("base_url").String()
ApiKey = apisixConf.Get("api_key").String()
+ DebugUrl = apisixConf.Get("debug_url").String()
}
}
diff --git a/api/conf/conf.json b/api/conf/conf.json
index d160087..095f5f5 100644
--- a/api/conf/conf.json
+++ b/api/conf/conf.json
@@ -13,7 +13,8 @@
},
"apisix": {
"base_url": "http://127.0.0.1:9080/apisix/admin",
- "api_key": "edd1c9f034335f136f87ad84b625c8f1"
+ "api_key": "edd1c9f034335f136f87ad84b625c8f1",
+ "debug_url": "http://127.0.0.1:9080/"
}
},
"authentication": {
diff --git a/api/conf/conf_preview.json b/api/conf/conf_preview.json
index 07e304a..e4df55c 100644
--- a/api/conf/conf_preview.json
+++ b/api/conf/conf_preview.json
@@ -13,7 +13,8 @@
},
"apisix": {
"base_url": "#apisixBaseUrl#",
- "api_key": "#apisixApiKey#"
+ "api_key": "#apisixApiKey#",
+ "debug_url": "#apisixDebugUrl#"
}
},
"authentication": {
diff --git a/api/route/route.go b/api/route/route.go
index d5546f4..49be378 100644
--- a/api/route/route.go
+++ b/api/route/route.go
@@ -522,7 +522,7 @@ func getRouteWithApisixUrl(c *gin.Context) {
return
}
result.Name = route.Name
- url := conf.BaseUrl
+ url := conf.DebugUrl
reg, _ := regexp.Compile("://([^/:]+)(:\\d*)?")
res := reg.FindSubmatch([]byte(url))
var addr string
diff --git a/api/run/run.sh b/api/run/run.sh
index 4bb26dc..00ef9b1 100755
--- a/api/run/run.sh
+++ b/api/run/run.sh
@@ -26,6 +26,8 @@ export MYSQL_PASSWORD=123456
export SYSLOG_HOST=127.0.0.1
export APISIX_BASE_URL="http://127.0.0.1:9080/apisix/admin"
export APISIX_API_KEY="edd1c9f034335f136f87ad84b625c8f1"
+export APISIX_DEBUG_URL="http://127.0.0.1:9080/"
+
if [[ "$unamestr" == 'Darwin' ]]; then
sed -i '' -e "s%#mysqlAddress#%`echo $MYSQL_SERVER_ADDRESS`%g" ${pwd}/conf.json
@@ -34,6 +36,7 @@ if [[ "$unamestr" == 'Darwin' ]]; then
sed -i '' -e "s%#syslogAddress#%`echo $SYSLOG_HOST`%g" ${pwd}/conf.json
sed -i '' -e "s%#apisixBaseUrl#%`echo $APISIX_BASE_URL`%g" ${pwd}/conf.json
sed -i '' -e "s%#apisixApiKey#%`echo $APISIX_API_KEY`%g" ${pwd}/conf.json
+ sed -i '' -e "s%#apisixDebugUrl#%`echo $APISIX_DEBUG_URL`%g" ${pwd}/conf.json
else
sed -i -e "s%#mysqlAddress#%`echo $MYSQL_SERVER_ADDRESS`%g" ${pwd}/conf.json
sed -i -e "s%#mysqlUser#%`echo $MYSQL_USER`%g" ${pwd}/conf.json
@@ -41,6 +44,7 @@ else
sed -i -e "s%#syslogAddress#%`echo $SYSLOG_HOST`%g" ${pwd}/conf.json
sed -i -e "s%#apisixBaseUrl#%`echo $APISIX_BASE_URL`%g" ${pwd}/conf.json
sed -i -e "s%#apisixApiKey#%`echo $APISIX_API_KEY`%g" ${pwd}/conf.json
+ sed -i -e "s%#apisixDebugUrl#%`echo $APISIX_DEBUG_URL`%g" ${pwd}/conf.json
fi
diff --git a/api/service/consumer.go b/api/service/consumer.go
index 98dee45..e5490c6 100644
--- a/api/service/consumer.go
+++ b/api/service/consumer.go
@@ -189,7 +189,7 @@ func ConsumerCreate(param interface{}, id string) error {
if _, ok := err.(*errno.HttpError); ok {
return err
}
- e := errno.New(errno.ApisixSslCreateError, err.Error())
+ e := errno.New(errno.ApisixConsumerCreateError, err.Error())
return e
}
diff --git a/compose/manager_conf/build.sh b/compose/manager_conf/build.sh
index 22f2e2f..8591e7f 100755
--- a/compose/manager_conf/build.sh
+++ b/compose/manager_conf/build.sh
@@ -25,6 +25,7 @@ export MYSQL_PASSWORD=123456
export SYSLOG_HOST=127.0.0.1
export APISIX_BASE_URL="http://192.17.5.11:9080/apisix/admin"
export APISIX_API_KEY="edd1c9f034335f136f87ad84b625c8f1"
+export APISIX_DEBUG_URL="http://127.0.0.1:9080/"
sed -i -e "s%#mysqlAddress#%`echo $MYSQL_SERVER_ADDRESS`%g" ${pwd}/conf.json
sed -i -e "s%#mysqlUser#%`echo $MYSQL_USER`%g" ${pwd}/conf.json
@@ -32,6 +33,7 @@ sed -i -e "s%#mysqlPWD#%`echo $MYSQL_PASSWORD`%g" ${pwd}/conf.json
sed -i -e "s%#syslogAddress#%`echo $SYSLOG_HOST`%g" ${pwd}/conf.json
sed -i -e "s%#apisixBaseUrl#%`echo $APISIX_BASE_URL`%g" ${pwd}/conf.json
sed -i -e "s%#apisixApiKey#%`echo $APISIX_API_KEY`%g" ${pwd}/conf.json
+sed -i -e "s%#apisixDebugUrl#%`echo $APISIX_DEBUG_URL`%g" ${pwd}/conf.json
cd /go/manager-api
exec ./manager-api
diff --git a/src/pages/Route/transform.ts b/src/pages/Route/transform.ts
index 3288b20..b8a912d 100644
--- a/src/pages/Route/transform.ts
+++ b/src/pages/Route/transform.ts
@@ -349,10 +349,6 @@ export const transformRouteDebugData = (data: RouteModule.Body) => {
{
url: `${protocol}://${url}`,
},
- {
- // FIXME
- url: `${protocol}://${window.location.hostname}:9080`,
- },
];
}
});