Update tsa/tsacmd/command.go
@@ -144,21 +144,18 @@ func (cmd *TSACommand) Runner(args []string) (ifrit.Runner, error) {
httpClient: httpClient,
sessionTeam: sessionAuthTeam,
}
- // Starts a goroutine that his purpose is to basically listen to the
- // SIGHUP syscall to then reload the config.
- // For now it only reload the TSACommand.AuthorizedKeys but any
- // other configuration could be added
+ // Starts a goroutine whose purpose is to listen to the
+ // SIGHUP syscall and reload configuration upon receiving the signal.
+ // For now it only reloads the TSACommand.AuthorizedKeys but
+ // other configuration can potentially be added.
go func() {
- // Set up channel on which to send signal notifications.
- // We must use a buffered channel or risk missing the signal
- // if we're not ready to receive when the signal is sent.
- c := make(chan os.Signal, 1)
+ reloadWorkerKeys := make(chan os.Signal, 1)
defer close(c)
signal.Notify(c, syscall.SIGHUP)
for {
// Block until a signal is received.
- _ = <-c
+ <-c
logger.Info("reloading-config")
@@ -174,7 +171,7 @@ func (cmd *TSACommand) Runner(args []string) (ifrit.Runner, error) {
continue
}
- // compute again the config so it's updated
+ // Reconfigure the SSH server with the new keys
config, err := cmd.configureSSHServer(sessionAuthTeam, cmd.AuthorizedKeys.Keys, teamAuthorizedKeys)
if err != nil {
logger.Error("failed to configure SSH server: %s", err)
