no message
parent
bc4bdc7414
commit
dfd23b94ea
|
@ -3,11 +3,6 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="7cf7b6b3-0082-44ef-bb0f-bfcc57e19eb1" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/controller/file.go" beforeDir="false" afterPath="$PROJECT_DIR$/controller/file.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/controller/hardware.go" beforeDir="false" afterPath="$PROJECT_DIR$/controller/hardware.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/db/elasticEngine.go" beforeDir="false" afterPath="$PROJECT_DIR$/db/elasticEngine.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/main.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/model/hardware.go" beforeDir="false" afterPath="$PROJECT_DIR$/model/hardware.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
@ -36,7 +31,7 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="GOROOT" path="D:/programs/GOROOT" />
|
||||
<component name="GOROOT" path="C:\Go" />
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
|
@ -50,8 +45,9 @@
|
|||
<property name="configurable.Project.GOPATH.is.expanded" value="true" />
|
||||
<property name="go.import.settings.migrated" value="true" />
|
||||
<property name="go.sdk.automatically.set" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/.." />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="restartRequiresConfirmation" value="false" />
|
||||
<property name="settings.editor.selected.configurable" value="vcs.Git" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
// 使用 IntelliSense 了解相关属性。
|
||||
// 悬停以查看现有属性的描述。
|
||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"program": "${workspaceRoot}/main.go",
|
||||
"env": {},
|
||||
"args": [],
|
||||
"cwd":".",
|
||||
}
|
||||
]
|
||||
}
|
34
main.go
34
main.go
|
@ -7,35 +7,35 @@ import (
|
|||
"background/db"
|
||||
"background/logs"
|
||||
"background/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/tommy351/gin-sessions"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
sessions "github.com/tommy351/gin-sessions"
|
||||
)
|
||||
|
||||
var (
|
||||
userController = controller.UserController{}
|
||||
mailContoller = controller.MailController{}
|
||||
fileController = controller.FileController{}
|
||||
userController = controller.UserController{}
|
||||
mailContoller = controller.MailController{}
|
||||
fileController = controller.FileController{}
|
||||
webhookController = controller.WebHookController{}
|
||||
)
|
||||
|
||||
|
||||
func CORSMiddleware(c *gin.Context) {
|
||||
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
|
||||
if config.ApiConfig().RunMode == "release"{
|
||||
if config.ApiConfig().RunMode == "release" {
|
||||
c.Writer.Header().Set("Access-Control-Allow-Origin", "https://testingcloud.club")
|
||||
|
||||
}else{
|
||||
} else {
|
||||
c.Writer.Header().Set("Access-Control-Allow-Origin", "http://localhost:8080")
|
||||
}
|
||||
c.Writer.Header().Set("Access-Control-Max-Age", "86400")
|
||||
c.Writer.Header().Set("Access-Control-Allow-Headers",
|
||||
"X-Requested-With," +
|
||||
" Content-Type, Origin, Authorization," +
|
||||
"Accept,Client-Security-Token, Accept-Encoding," +
|
||||
"x-access-token,Access-Control-Request-Method," +
|
||||
"Access-Control-Request-Headers")
|
||||
"X-Requested-With,"+
|
||||
" Content-Type, Origin, Authorization,"+
|
||||
"Accept,Client-Security-Token, Accept-Encoding,"+
|
||||
"x-access-token,Access-Control-Request-Method,"+
|
||||
"Access-Control-Request-Headers")
|
||||
c.Writer.Header().Set("Access-Control-Expose-Headers", "Content-Length")
|
||||
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
|
||||
|
||||
|
@ -71,9 +71,9 @@ func InitRedisConfig() {
|
|||
}
|
||||
}
|
||||
|
||||
func InitElasticSearch(){
|
||||
e := db.GetElastic().CreateIndex("hardware",model.HardwareTypeMapping())
|
||||
if nil != e{
|
||||
func InitElasticSearch() {
|
||||
e := db.GetElastic().CreateIndex("hardware", model.HardwareTypeMapping())
|
||||
if nil != e {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ func main() {
|
|||
}
|
||||
hookapi := r.Group("hookapi")
|
||||
{
|
||||
hookapi.POST("/push_hook/:repo",webhookController.PushHook)
|
||||
hookapi.POST("/push_hook/:repo", webhookController.PushHook)
|
||||
}
|
||||
e := r.Run(":" + strconv.Itoa(config.GetPort()))
|
||||
if nil != e {
|
||||
|
|
Loading…
Reference in New Issue