Skip to content

FriendlyCaptcha/hareply

Repository files navigation

hareply

hareply is a small tool that replies to HAProxy's agent-check with the contents of a given file.

CLI usage

# Print help
hareply -h

# Print help for serve command
hareply serve -h

# Print version information
hareply version

# Serve from port 8020 and a specific path.
hareply serve -f /some/path/to/agentstate -p 8020

# Serve from port 8442 and filepath `agentstate` (the defaults).
hareply serve

As a library

hareply can also be used as a library, see the godoc for the hareply package.

Error handling

  • The response "agentstate" file is read on startup, if that fails the program will exit.
  • The file is read again on any TCP connection, if that fails the last known file contents are used.
  • If the value in the file is not a valid response for agent-check, the last valid response is returned instead.

Release

Releases are built using goreleaser, see the goreleaser.yml file.

To mint a (test) release locally, install goreleaser and run

goreleaser --snapshot --skip=publish --clean

License

MIT 🎶.