server.go 690 B

1234567891011121314151617181920212223242526272829303132
  1. package environ
  2. import (
  3. context "context"
  4. grpc "google.golang.org/grpc"
  5. )
  6. // Server implements the EnvironmentServer
  7. type Server struct {
  8. UnimplementedEnvironmentSvcServer
  9. }
  10. // GetEnvironment responds with the information about the environment
  11. func (s *Server) GetEnvironment(context.Context, *Void) (*Environment, error) {
  12. rsp := &Environment{
  13. Version: Version,
  14. GitCommit: GitCommit,
  15. BuildTime: BuildTime,
  16. GoOsArch: GoOsArch,
  17. ApiVersion: APIVersion,
  18. GoVersion: GoVersion,
  19. }
  20. return rsp, nil
  21. }
  22. // NewServer returns a new environ.Server
  23. func NewServer(grpcServer *grpc.Server) *Server {
  24. s := &Server{}
  25. RegisterEnvironmentSvcServer(grpcServer, s)
  26. return s
  27. }