Skip to content

Commit 78d1c32

Browse files
author
Felix Breidenstein
committed
Added 'address' field to AlamosMessage
1 parent ba7ec14 commit 78d1c32

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

alamos/alamos.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ type AlamosMessage struct {
1818
}
1919

2020
type AlamosClient struct {
21-
URL string
22-
Sender string
23-
Test bool
21+
URL string
22+
Sender string
23+
Address string
24+
Test bool
2425
}
2526

2627
type AlamosResponse struct {
@@ -47,12 +48,13 @@ func (c *AlamosClient) newAlamosMessage() AlamosMessage {
4748
return m
4849
}
4950

50-
func NewClient(host string, sender string, test bool) AlamosClient {
51+
func NewClient(host string, sender string, address string, test bool) AlamosClient {
5152

5253
return AlamosClient{
53-
URL: fmt.Sprintf("%s%s", host, RestURL),
54-
Sender: sender,
55-
Test: test,
54+
URL: fmt.Sprintf("%s%s", host, RestURL),
55+
Sender: sender,
56+
Address: address,
57+
Test: test,
5658
}
5759
}
5860

config_example.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ debug: True
55

66
alamos_host: "localhost"
77
alamos_sender: "prometheus-gateway"
8+
alamos_receiver: "admingroup42"

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
type config struct {
2020
AlamosHost string `yaml:"alamos_host"`
2121
Sender string `yaml:"alamos_sender"`
22+
Receiver string `yaml:"alamos_receiver"`
2223
Debug bool `yaml:"debug"`
2324
Listen string `yaml:"listen"`
2425
}
@@ -108,7 +109,7 @@ func init() {
108109

109110
func main() {
110111
cfg := readConfigFile()
111-
client := alamos.NewClient(cfg.AlamosHost, cfg.Sender, cfg.Debug)
112+
client := alamos.NewClient(cfg.AlamosHost, cfg.Sender, cfg.Receiver, cfg.Debug)
112113

113114
http.Handle("/input", inputHandler(&client, cfg.Debug))
114115

main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestInputHandler(t *testing.T) {
2424
server := alarmosMock()
2525
defer server.Close()
2626

27-
client := alamos.NewClient(server.URL, "test", true)
27+
client := alamos.NewClient(server.URL, "", "", true)
2828
debug := true
2929

3030
rr := httptest.NewRecorder()

0 commit comments

Comments
 (0)