start working on client component
This commit is contained in:
parent
bed55a63a2
commit
c6d5fafa7d
3 changed files with 25 additions and 3 deletions
15
client/client.go
Normal file
15
client/client.go
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.sr.ht/~cco/go-scopes/config"
|
||||||
|
"git.sr.ht/~cco/go-scopes/lib"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Cfg struct {
|
||||||
|
*config.BaseCfg
|
||||||
|
Url string
|
||||||
|
}
|
||||||
|
|
||||||
|
func Send(act lib.Action) bool {
|
||||||
|
return true
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package etc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.sr.ht/~cco/go-scopes/app"
|
"git.sr.ht/~cco/go-scopes/app"
|
||||||
|
"git.sr.ht/~cco/go-scopes/client"
|
||||||
"git.sr.ht/~cco/go-scopes/config"
|
"git.sr.ht/~cco/go-scopes/config"
|
||||||
"git.sr.ht/~cco/go-scopes/lib"
|
"git.sr.ht/~cco/go-scopes/lib"
|
||||||
"git.sr.ht/~cco/go-scopes/lib/action"
|
"git.sr.ht/~cco/go-scopes/lib/action"
|
||||||
|
@ -36,10 +37,15 @@ func Config() lib.Config {
|
||||||
Port: ovr("8123", SERVER_PORT),
|
Port: ovr("8123", SERVER_PORT),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_client := &client.Cfg{
|
||||||
|
BaseCfg: b("test-client", core.Start),
|
||||||
|
Url: ovr("http://localhost:8123", SERVER_URL),
|
||||||
|
}
|
||||||
|
|
||||||
test_rcvr := b("test-receiver", core.Start).
|
test_rcvr := b("test-receiver", core.Start).
|
||||||
AddAction("demo", action.Base(AH_Receiver))
|
AddAction("demo", action.Base(AH_Receiver))
|
||||||
|
|
||||||
app_c.Add(config_c, server_c, test_rcvr)
|
app_c.Add(config_c, server_c, test_client, test_rcvr)
|
||||||
|
|
||||||
return app_c
|
return app_c
|
||||||
}
|
}
|
||||||
|
@ -56,6 +62,7 @@ const (
|
||||||
LOGFILE = "logfile"
|
LOGFILE = "logfile"
|
||||||
LOGLEVEL = "loglevel"
|
LOGLEVEL = "loglevel"
|
||||||
SERVER_PORT = "server_port"
|
SERVER_PORT = "server_port"
|
||||||
|
SERVER_URL = "server_url"
|
||||||
)
|
)
|
||||||
|
|
||||||
// in a production scenario this should be put in a separate
|
// in a production scenario this should be put in a separate
|
||||||
|
|
|
@ -18,12 +18,12 @@ func TestConfig(tb *tbase.T) {
|
||||||
t.Run("config", ConfigTest)
|
t.Run("config", ConfigTest)
|
||||||
t.Run("send", SendTest)
|
t.Run("send", SendTest)
|
||||||
t.TearDownApp()
|
t.TearDownApp()
|
||||||
t.AssertEqual(t.LogCount(true), 7)
|
t.AssertEqual(t.LogCount(true), 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
func AppTest(t *testing.T) {
|
func AppTest(t *testing.T) {
|
||||||
ctx := t.Ctx
|
ctx := t.Ctx
|
||||||
t.AssertEqual(len(ctx.Services()), 4)
|
t.AssertEqual(len(ctx.Services()), 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigTest(t *testing.T) {
|
func ConfigTest(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue