read env
This commit is contained in:
+12
-3
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gzzn.com/mini/ciimsproxy/internal"
|
||||
@@ -10,20 +11,28 @@ import (
|
||||
const (
|
||||
servicePrefix string = "/services/ExchangeService"
|
||||
// defaultURL string = "http://localhost:8080"
|
||||
defaultURL string = "http://192.168.10.96:8080"
|
||||
//defaultURL string = "http://192.168.10.96:8080"
|
||||
)
|
||||
|
||||
var defaultURL = ""
|
||||
|
||||
func main() {
|
||||
defaultURL = os.Getenv("CIIMS_SERVER")
|
||||
listen := os.Getenv("PROXY_LISTEN")
|
||||
if listen == "" {
|
||||
listen = ":9090"
|
||||
}
|
||||
println("use ciims : " + defaultURL)
|
||||
r := gin.Default()
|
||||
r.GET("/ping", func(c *gin.Context) {
|
||||
c.JSON(200, gin.H{
|
||||
"message": "pong",
|
||||
})
|
||||
})
|
||||
r.POST("/msg", sendMessage)
|
||||
r.POST("/send", sendMessage)
|
||||
r.POST("/receive", receiveMessage)
|
||||
// r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
|
||||
r.Run(":9090")
|
||||
r.Run(listen)
|
||||
}
|
||||
|
||||
func sendMessage(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user