https://github.com/aserto-dev/service-host
Code for creating and managing services
https://github.com/aserto-dev/service-host
Last synced: 5 months ago
JSON representation
Code for creating and managing services
- Host: GitHub
- URL: https://github.com/aserto-dev/service-host
- Owner: aserto-dev
- License: apache-2.0
- Created: 2023-06-28T15:23:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-07T19:56:36.000Z (over 1 year ago)
- Last Synced: 2025-04-15T23:52:31.567Z (about 1 year ago)
- Language: Go
- Size: 78.1 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Service-host package
This is a very basic package that allows users to create and manage GRPC and REST services.
The service factory allows creating a service instance based on the API configuration.
The service manager allows controlling multiple services and provides basic dependency management.
Example of a very basic eds reader service creation and start:
```
...
edgeAPI := builder.API{}
edgeAPI.GRPC.ListenAddress = "localhost:8080"
edgeAPI.Gateway.ListenAddress = "localhost:8081"
edgeDir, err := eds.New(&directory.Config{DBPath: "/tmp/my.db", Seed: true}, &logger)
if err != nil {
log.Fatal(err)
}
edgeReader, err := factoryInstance.CreateService(&edgeAPI, opts, func(server *grpc.Server) {
reader.RegisterReaderServer(server, edgeDir)
}, func(ctx context.Context, mux *runtime.ServeMux, grpcEndpoint string, opts []grpc.DialOption) error {
return reader.RegisterReaderHandlerFromEndpoint(ctx, mux, grpcEndpoint, opts)
}, true)
if err != nil {
log.Fatal(err)
}
managerInstance.AddGRPCServer(edgeReader)
managerInstance.StartServers(ctx)
...
```