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