1
0

feat(GODT-2771): gRPC calls for TLS certificates.

This commit is contained in:
Xavier Michelon
2023-08-17 10:22:56 +02:00
parent 2d6f42e0b5
commit f57a40677e
14 changed files with 1578 additions and 1073 deletions

View File

@ -21,8 +21,6 @@ import (
"context"
"encoding/base64"
"errors"
"os"
"path/filepath"
"runtime"
"github.com/Masterminds/semver/v3"
@ -364,26 +362,6 @@ func (s *Service) ReportBug(_ context.Context, report *ReportBugRequest) (*empty
return &emptypb.Empty{}, nil
}
func (s *Service) ExportTLSCertificates(_ context.Context, folderPath *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("folderPath", folderPath).Info("ExportTLSCertificates")
go func() {
defer async.HandlePanic(s.panicHandler)
cert, key := s.bridge.GetBridgeTLSCert()
if err := os.WriteFile(filepath.Join(folderPath.Value, "cert.pem"), cert, 0o600); err != nil {
_ = s.SendEvent(NewGenericErrorEvent(ErrorCode_TLS_CERT_EXPORT_ERROR))
}
if err := os.WriteFile(filepath.Join(folderPath.Value, "key.pem"), key, 0o600); err != nil {
_ = s.SendEvent(NewGenericErrorEvent(ErrorCode_TLS_KEY_EXPORT_ERROR))
}
}()
return &emptypb.Empty{}, nil
}
func (s *Service) ForceLauncher(_ context.Context, launcher *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("launcher", launcher.Value).Debug("ForceLauncher")