(req dto.SSHUpdate)
| 205 | } |
| 206 | |
| 207 | func (u *SSHService) Update(req dto.SSHUpdate) error { |
| 208 | serviceName, err := loadServiceName() |
| 209 | if err != nil { |
| 210 | return err |
| 211 | } |
| 212 | |
| 213 | directives, _, err := parseSSHConfigTree(sshPath) |
| 214 | if err != nil { |
| 215 | return err |
| 216 | } |
| 217 | oldPortValue := strings.Join(loadSSHPortValues(directives), ",") |
| 218 | if err := updateSSHDirectiveValue(req.Key, req.NewValue, directives); err != nil { |
| 219 | return err |
| 220 | } |
| 221 | if req.Key == "Port" { |
| 222 | handleSSHPortUpdate(oldPortValue, req.NewValue) |
| 223 | } |
| 224 | |
| 225 | return restartSSHService(serviceName) |
| 226 | } |
| 227 | |
| 228 | func loadSSHServiceStatus(data *dto.SSHInfo) { |
| 229 | serviceName, err := loadServiceName() |
nothing calls this directly
no test coverage detected