Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
ctx, cancel := context.WithCancel(context.Background())

sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
go func() {
select {
case <-sigChan:
Expand Down
3 changes: 2 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ func ResolveConfig() (*Config, error) {
dir += "/"
}
allowedDirs = append(allowedDirs, dir)
slog.Info("Configured allowed directories", "allowed_directories", allowedDirs)
}

slog.Info("Configured allowed directories", "allowed_directories", allowedDirs)

// Collect all parsing errors before returning the error, so the user sees all issues with config
// in one error message.
var err error
Expand Down
18 changes: 15 additions & 3 deletions test/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,28 @@

set -euxo pipefail

handle_term()
{
handle_term() {
echo "received TERM signal"
echo "stopping nginx-agent ..."
kill -TERM "${agent_pid}" 2>/dev/null
wait -n ${agent_pid}
echo "stopping nginx ..."
kill -TERM "${nginx_pid}" 2>/dev/null
wait -n ${nginx_pid}
}

handle_quit() {
echo "received QUIT signal"
echo "stopping nginx-agent ..."
kill -QUIT "${agent_pid}" 2>/dev/null
wait -n ${agent_pid}
echo "stopping nginx ..."
kill -QUIT "${nginx_pid}" 2>/dev/null
wait -n ${nginx_pid}
}

trap 'handle_term' TERM
trap 'handle_term' TERM
trap 'handle_quit' QUIT

# Launch nginx
echo "starting nginx ..."
Expand Down
11 changes: 10 additions & 1 deletion test/docker/nginxless-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ handle_term()
echo "received TERM signal"
echo "stopping nginx-agent ..."
kill -TERM "${agent_pid}" 2>/dev/null
wait -n ${agent_pid}
}

trap 'handle_term' TERM
handle_quit() {
echo "received QUIT signal"
echo "stopping nginx-agent ..."
kill -QUIT "${agent_pid}" 2>/dev/null
wait -n ${agent_pid}
}

trap 'handle_term' TERM
trap 'handle_quit' QUIT

cat /etc/nginx-agent/nginx-agent.conf;

Expand Down