fix: add a config item APISIX_DEBUG_URL to support online debug (#514)
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%#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 @@
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 @@
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 @@
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 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 @@
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 @@
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 @@
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 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%#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 @@
{
url: `${protocol}://${url}`,
},
- {
- // FIXME
- url: `${protocol}://${window.location.hostname}:9080`,
- },
];
}
});