Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f06128ce8 | ||
|
|
be07dc8749 |
@@ -43,6 +43,7 @@ func Init() *Args {
|
|||||||
keyFile := flag.String("keyFile", "./cert/key.pem", "path of keyfile")
|
keyFile := flag.String("keyFile", "./cert/key.pem", "path of keyfile")
|
||||||
portHttp := flag.Uint("http-port", 8100, "json server communication for http/ws")
|
portHttp := flag.Uint("http-port", 8100, "json server communication for http/ws")
|
||||||
portHttps := flag.Uint("https-port", 8101, "json server communication for http/wss")
|
portHttps := flag.Uint("https-port", 8101, "json server communication for http/wss")
|
||||||
|
remotePort := flag.Uint("remotePort", 9500, "remote Port of gui user interface")
|
||||||
rootDir := flag.String("workingDir", "./", "working directory")
|
rootDir := flag.String("workingDir", "./", "working directory")
|
||||||
dbmFile := flag.String("dbm", "/test/test", "dbm file name")
|
dbmFile := flag.String("dbm", "/test/test", "dbm file name")
|
||||||
debug := flag.Bool("debug", false, "debug flag")
|
debug := flag.Bool("debug", false, "debug flag")
|
||||||
@@ -56,8 +57,9 @@ func Init() *Args {
|
|||||||
KeyFile: *keyFile,
|
KeyFile: *keyFile,
|
||||||
},
|
},
|
||||||
Port: models.Port{
|
Port: models.Port{
|
||||||
Http: *portHttp,
|
Http: *portHttp,
|
||||||
Https: *portHttps,
|
Https: *portHttps,
|
||||||
|
Remote: *remotePort,
|
||||||
},
|
},
|
||||||
RootDir: *rootDir,
|
RootDir: *rootDir,
|
||||||
DBMFile: *dbmFile,
|
DBMFile: *dbmFile,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ func (d *DBMHandler) Json_Data(c *gin.Context) {
|
|||||||
Path: res.Path,
|
Path: res.Path,
|
||||||
Type: res.Type,
|
Type: res.Type,
|
||||||
Value: res.Value,
|
Value: res.Value,
|
||||||
|
Drivers: &res.Drivers,
|
||||||
HasChild: res.Datapoints != nil,
|
HasChild: res.Datapoints != nil,
|
||||||
Rights: res.ReadWrite,
|
Rights: res.ReadWrite,
|
||||||
})
|
})
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -7,7 +7,7 @@ require (
|
|||||||
github.com/gin-gonic/gin v1.10.0
|
github.com/gin-gonic/gin v1.10.0
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/gorilla/websocket v1.5.3
|
github.com/gorilla/websocket v1.5.3
|
||||||
github.com/tecamino/tecamino-json_data v0.0.16
|
github.com/tecamino/tecamino-json_data v0.0.17
|
||||||
github.com/tecamino/tecamino-logger v0.2.0
|
github.com/tecamino/tecamino-logger v0.2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -71,8 +71,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
|
|||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/tecamino/tecamino-json_data v0.0.16 h1:aZFxnhm4g6WMDPoqy4HosUk7vl0DB0iIcVs8bbT4MzU=
|
github.com/tecamino/tecamino-json_data v0.0.17 h1:M12UzKbfIgu/q3ERsEhGNDV3DYOvc0TioU288kQjDCA=
|
||||||
github.com/tecamino/tecamino-json_data v0.0.16/go.mod h1:LLlyD7Wwqplb2BP4PeO86EokEcTRidlW5MwgPd1T2JY=
|
github.com/tecamino/tecamino-json_data v0.0.17/go.mod h1:LLlyD7Wwqplb2BP4PeO86EokEcTRidlW5MwgPd1T2JY=
|
||||||
github.com/tecamino/tecamino-logger v0.2.0 h1:NPH/Gg9qRhmVoW8b39i1eXu/LEftHc74nyISpcRG+XU=
|
github.com/tecamino/tecamino-logger v0.2.0 h1:NPH/Gg9qRhmVoW8b39i1eXu/LEftHc74nyISpcRG+XU=
|
||||||
github.com/tecamino/tecamino-logger v0.2.0/go.mod h1:0M1E9Uei/qw3e3WA1x3lBo1eP3H5oeYE7GjYrMahnj8=
|
github.com/tecamino/tecamino-logger v0.2.0/go.mod h1:0M1E9Uei/qw3e3WA1x3lBo1eP3H5oeYE7GjYrMahnj8=
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -23,7 +23,7 @@ func main() {
|
|||||||
|
|
||||||
//initialize new server
|
//initialize new server
|
||||||
dbmHandler.Log.Debug("main", "initialize new server instance")
|
dbmHandler.Log.Debug("main", "initialize new server instance")
|
||||||
s := ws.NewServer(a.AllowOrigins, 9000)
|
s := ws.NewServer(a.AllowOrigins, a.Port.Remote)
|
||||||
|
|
||||||
//set routes
|
//set routes
|
||||||
dbmHandler.Log.Debug("main", "setting routes")
|
dbmHandler.Log.Debug("main", "setting routes")
|
||||||
|
|||||||
@@ -385,6 +385,7 @@ func (d *Datapoint) Publish(eventType string) error {
|
|||||||
Event: eventType,
|
Event: eventType,
|
||||||
Uuid: d.Uuid,
|
Uuid: d.Uuid,
|
||||||
Path: d.Path,
|
Path: d.Path,
|
||||||
|
Type: d.Type,
|
||||||
Value: d.Value,
|
Value: d.Value,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type Port struct {
|
type Port struct {
|
||||||
Http uint
|
Http uint
|
||||||
Https uint
|
Https uint
|
||||||
|
Remote uint
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ func TestUpdateDps(t *testing.T) {
|
|||||||
|
|
||||||
func TestServer(t *testing.T) {
|
func TestServer(t *testing.T) {
|
||||||
fmt.Println("start")
|
fmt.Println("start")
|
||||||
server := ws.NewServer([]string{".*"})
|
server := ws.NewServer([]string{".*"}, 9500)
|
||||||
|
|
||||||
t.Fatal(server.ServeHttp("http://localhost", 8100))
|
t.Fatal(server.ServeHttp("http://localhost", 8100))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user