Skip to content

Commit

Permalink
Version: 0.8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Oct 17, 2021
1 parent 9f4fcd1 commit 26072f9
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions cmd/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/spf13/cobra"
"github.com/yaoapp/xiang/global"
"github.com/yaoapp/xiang/share"
)

var domainCmd = &cobra.Command{
Expand All @@ -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)
},
}
6 changes: 3 additions & 3 deletions cmd/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -59,7 +59,7 @@ var startCmd = &cobra.Command{

}

domain := global.DOMAIN
domain := share.DOMAIN
if domain == "*.iqka.com" {
domain = "local.iqka.com"
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/spf13/cobra"
"github.com/yaoapp/xiang/global"
"github.com/yaoapp/xiang/share"
)

var versionCmd = &cobra.Command{
Expand All @@ -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)
},
}
3 changes: 3 additions & 0 deletions global/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import (
"github.com/yaoapp/xun/capsule"
)

// Conf 配置文件
var Conf config.Config

// Script 脚本文件类型
type Script struct {
Name string
Expand Down
8 changes: 7 additions & 1 deletion global/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions global/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion global/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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) {
Expand Down
14 changes: 2 additions & 12 deletions global/vars.go → share/vars.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
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"

// AllowHosts 解析后的许可域
var AllowHosts = []string{}

// Conf 配置文件
var Conf config.Config

// FileServer 静态服务
var FileServer http.Handler = http.FileServer(data.AssetFS())

// 初始化配置
func init() {

Expand Down

0 comments on commit 26072f9

Please sign in to comment.