Skip to content

Commit

Permalink
Merge pull request #3 from FriendlyCaptcha/fix-start-cmd-in-systemd
Browse files Browse the repository at this point in the history
Fix start cmd in systemd
  • Loading branch information
gzuidhof authored Apr 17, 2024
2 parents a9cb935 + 465c49f commit 3a4d8f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/packages/hareply.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
HAREPLY_FILE=/etc/hareply/agentstate
HAREPLY_STATE_FILE=/etc/hareply/agentstate
2 changes: 1 addition & 1 deletion assets/packages/hareply.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ After=syslog.target network-online.target

[Service]
EnvironmentFile=/etc/hareply/hareply.conf
ExecStart=/usr/bin/hareply
ExecStart=/usr/bin/hareply serve
Restart=always
Type=simple

Expand Down
10 changes: 5 additions & 5 deletions cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ type Config struct {
Debug bool `help:"Enable debug mode."`

Serve struct {
Host string `help:"Host to listen on." default:""`
Port int `help:"Port to reply on." short:"p" default:"8442"`
File string `help:"Path to read response from." short:"f" default:"agentstate"`
Host string `help:"Host to listen on." default:""`
Port int `help:"Port to reply on." short:"p" default:"8442"`
StateFile string `help:"Path to read response from." short:"f" default:"agentstate"`
} `cmd:"" help:"Start hareply TCP responder service."`

Version kong.VersionFlag
Expand All @@ -33,7 +33,7 @@ func CLI(ctx context.Context, w io.Writer, args []string, opts ...kong.Option) e
opts = append(opts,
kong.Name("hareply"),
kong.Description("A simple TCP server that replies with a response read from a file."),
kong.DefaultEnvars("HAREPLY_"),
kong.DefaultEnvars("HAREPLY"),
kong.Vars{"version": buildinfo.FullVersion()},
)

Expand All @@ -51,7 +51,7 @@ func CLI(ctx context.Context, w io.Writer, args []string, opts ...kong.Option) e

switch kctx.Command() {
case "serve":
app, err := hareply.New(cli.Serve.File,
app, err := hareply.New(cli.Serve.StateFile,
hareply.WithPort(cli.Serve.Port),
hareply.WithHost(cli.Serve.Host),
hareply.WithLogger(logger),
Expand Down

0 comments on commit 3a4d8f0

Please sign in to comment.