Skip to content

Commit 60b0114

Browse files
committed
fix: Remove JSON dump and clipboard copy functionality.
This commit removes the code responsible for converting the dump to JSON and copying it to the clipboard. The focus is shifted towards sending data via the API with refined authorization handling. This improves clarity and aligns with the intended functionality.
1 parent 8fa6bc4 commit 60b0114

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

cmd/stream/main.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"encoding/json"
54
"fmt"
65
"github.com/softwareplace/wireguard-api/cmd/stream/parse"
76
"github.com/softwareplace/wireguard-api/cmd/stream/spec"
@@ -34,25 +33,25 @@ func main() {
3433
os.Exit(1)
3534
}
3635

37-
// Convert dump to JSON and print it
38-
jsonDump, err := json.MarshalIndent(dump, "", " ")
39-
if err != nil {
40-
log.Fatalf("Error converting dump to JSON: %v", err)
41-
}
42-
43-
// Copy JSON dump to clipboard
44-
if err := exec.Command("bash", "-c", fmt.Sprintf("echo '%s' | xclip -selection clipboard", string(jsonDump))).Run(); err != nil {
45-
log.Fatalf("Failed to copy JSON dump to clipboard: %v", err)
46-
}
47-
48-
fmt.Println("Dump as JSON:")
49-
fmt.Println(string(jsonDump))
36+
//// Convert dump to JSON and print it
37+
//jsonDump, err := json.MarshalIndent(dump, "", " ")
38+
//if err != nil {
39+
// log.Fatalf("Error converting dump to JSON: %v", err)
40+
//}
41+
//
42+
//// Copy JSON dump to clipboard
43+
//if err := exec.Command("bash", "-c", fmt.Sprintf("echo '%s' | xclip -selection clipboard", string(jsonDump))).Run(); err != nil {
44+
// log.Fatalf("Failed to copy JSON dump to clipboard: %v", err)
45+
//}
46+
//
47+
//fmt.Println("Dump as JSON:")
48+
//fmt.Println(string(jsonDump))
5049

5150
api := http_api.NewApi(types.Nil{})
5251
config := http_api.Config(streamEnv.Server).
5352
WithPath("peers/stream").
5453
WithHeader("Authorization", streamEnv.Authorization).
55-
WithHeader(request.XApiKey, streamEnv.Authorization).
54+
WithHeader(request.XApiKey, streamEnv.ApiKey).
5655
WithBody(dump).
5756
WithExpectedStatusCode(http.StatusCreated)
5857

0 commit comments

Comments
 (0)