generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e7e866
commit e318fa7
Showing
7 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module = "naughty" | ||
language = "go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module ftl/naughty | ||
|
||
go 1.23.0 | ||
|
||
replace ( | ||
github.com/TBD54566975/ftl => ./../../../../../.. | ||
|
||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// This is the echo module. | ||
package naughty | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"io" | ||
"net/http" | ||
"strconv" | ||
) | ||
|
||
// BeNaughty attempts to ping echo directly and returns true if successful | ||
// | ||
//ftl:verb export | ||
func BeNaughty(ctx context.Context, endpoint map[string]string) (string, error) { | ||
url := "http://" + endpoint["name"] + ":8893/healthz" // Replace with your actual URL | ||
|
||
resp, err := http.Get(url) | ||
if err != nil { | ||
return fmt.Sprintf("Error making GET request: to %s %v\n", url, err), nil | ||
} | ||
defer resp.Body.Close() | ||
|
||
_, err = io.ReadAll(resp.Body) | ||
if err != nil { | ||
return fmt.Sprintf("Error reading response body: %v\n", err), nil | ||
} | ||
return strconv.FormatBool(resp.StatusCode == 200), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters