Version: 0.8.6
This commit is contained in:
parent
9f4fcd131d
commit
26072f99d3
9 changed files with 25 additions and 25 deletions
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/yaoapp/xiang/global"
|
||||
"github.com/yaoapp/xiang/share"
|
||||
)
|
||||
|
||||
var domainCmd = &cobra.Command{
|
||||
|
|
@ -13,6 +13,6 @@ var domainCmd = &cobra.Command{
|
|||
Long: `显示绑定域名`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// Do Stuff Here
|
||||
fmt.Println(global.DOMAIN)
|
||||
fmt.Println(share.DOMAIN)
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"github.com/yaoapp/kun/maps"
|
||||
"github.com/yaoapp/kun/utils"
|
||||
"github.com/yaoapp/xiang/config"
|
||||
"github.com/yaoapp/xiang/global"
|
||||
"github.com/yaoapp/xiang/share"
|
||||
)
|
||||
|
||||
var inspectCmd = &cobra.Command{
|
||||
|
|
@ -15,8 +15,8 @@ var inspectCmd = &cobra.Command{
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
Boot()
|
||||
res := maps.Map{
|
||||
"version": global.VERSION,
|
||||
"domain": global.DOMAIN,
|
||||
"version": share.VERSION,
|
||||
"domain": share.DOMAIN,
|
||||
"config": config.Conf,
|
||||
}
|
||||
utils.Dump(res)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ var startCmd = &cobra.Command{
|
|||
mode = ""
|
||||
}
|
||||
|
||||
fmt.Printf(color.GreenString("\n象传应用引擎 v%s %s", global.VERSION, mode))
|
||||
fmt.Printf(color.GreenString("\n象传应用引擎 v%s %s", share.VERSION, mode))
|
||||
|
||||
// 加载数据模型 API 等
|
||||
global.Load(config.Conf)
|
||||
|
|
@ -59,7 +59,7 @@ var startCmd = &cobra.Command{
|
|||
|
||||
}
|
||||
|
||||
domain := global.DOMAIN
|
||||
domain := share.DOMAIN
|
||||
if domain == "*.iqka.com" {
|
||||
domain = "local.iqka.com"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/yaoapp/xiang/global"
|
||||
"github.com/yaoapp/xiang/share"
|
||||
)
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
|
|
@ -13,6 +13,6 @@ var versionCmd = &cobra.Command{
|
|||
Long: `显示当前版本号`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// Do Stuff Here
|
||||
fmt.Println(global.VERSION)
|
||||
fmt.Println(share.VERSION)
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ import (
|
|||
"github.com/yaoapp/xun/capsule"
|
||||
)
|
||||
|
||||
// Conf 配置文件
|
||||
var Conf config.Config
|
||||
|
||||
// Script 脚本文件类型
|
||||
type Script struct {
|
||||
Name string
|
||||
|
|
|
|||
|
|
@ -2,11 +2,17 @@ package global
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/yaoapp/xiang/data"
|
||||
"github.com/yaoapp/xiang/share"
|
||||
)
|
||||
|
||||
// FileServer 静态服务
|
||||
var FileServer http.Handler = http.FileServer(data.AssetFS())
|
||||
|
||||
// Middlewares 服务中间件
|
||||
var Middlewares = []gin.HandlerFunc{
|
||||
BindDomain,
|
||||
|
|
@ -16,7 +22,7 @@ var Middlewares = []gin.HandlerFunc{
|
|||
// BindDomain 绑定许可域名
|
||||
func BindDomain(c *gin.Context) {
|
||||
|
||||
for _, allow := range AllowHosts {
|
||||
for _, allow := range share.AllowHosts {
|
||||
if strings.Contains(c.Request.Host, allow) {
|
||||
c.Next()
|
||||
return
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ func processPing(process *gou.Process) interface{} {
|
|||
res := map[string]interface{}{
|
||||
"code": 200,
|
||||
"server": "象传应用引擎",
|
||||
"version": VERSION,
|
||||
"domain": DOMAIN,
|
||||
"version": share.VERSION,
|
||||
"domain": share.DOMAIN,
|
||||
"allows": Conf.Service.Allow,
|
||||
}
|
||||
return res
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/yaoapp/gou"
|
||||
"github.com/yaoapp/kun/any"
|
||||
"github.com/yaoapp/xiang/share"
|
||||
"github.com/yaoapp/xiang/table"
|
||||
"github.com/yaoapp/xun/capsule"
|
||||
)
|
||||
|
|
@ -15,7 +16,7 @@ func TestProcessPing(t *testing.T) {
|
|||
process := gou.NewProcess("xiang.global.ping")
|
||||
res, ok := processPing(process).(map[string]interface{})
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, res["version"], VERSION)
|
||||
assert.Equal(t, res["version"], share.VERSION)
|
||||
}
|
||||
|
||||
func TestProcessSearch(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
package global
|
||||
package share
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/yaoapp/xiang/config"
|
||||
"github.com/yaoapp/xiang/data"
|
||||
)
|
||||
|
||||
// VERSION 版本号
|
||||
const VERSION = "0.8.5"
|
||||
const VERSION = "0.8.6"
|
||||
|
||||
// DOMAIN 许可域
|
||||
const DOMAIN = "*.iqka.com"
|
||||
|
|
@ -17,12 +13,6 @@ const DOMAIN = "*.iqka.com"
|
|||
// AllowHosts 解析后的许可域
|
||||
var AllowHosts = []string{}
|
||||
|
||||
// Conf 配置文件
|
||||
var Conf config.Config
|
||||
|
||||
// FileServer 静态服务
|
||||
var FileServer http.Handler = http.FileServer(data.AssetFS())
|
||||
|
||||
// 初始化配置
|
||||
func init() {
|
||||
|
||||
Loading…
Add table
Reference in a new issue