diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 74d44ce..e203912 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -15,13 +15,13 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.3 +version: 0.1.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "v0.1.3" +appVersion: "v0.2.0" dependencies: - name: hull diff --git a/main.go b/main.go index fefcd7d..bb8df02 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ import ( optsgrpc "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/grpc/opts" optshttp "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts" + class "gitea.libretechconsulting.com/rmcguire/class-server/api/class/v1alpha1" "gitea.libretechconsulting.com/rmcguire/class-server/pkg/classgrpc" "gitea.libretechconsulting.com/rmcguire/class-server/pkg/config" "gitea.libretechconsulting.com/rmcguire/class-server/pkg/demogrpc" @@ -52,7 +53,11 @@ func main() { demoHTTP := demohttp.NewDemoHTTPServer(ctx, demoApp) demoGRPC := demogrpc.NewDemoGRPCServer(ctx, demoApp) - classGRPC := classgrpc.New(ctx) + classGRPC := classgrpc.New(&classgrpc.ClassServiceOpts{ + Ctx: ctx, + Font: class.Font_FONT_AVATAR, + Text: "Indiana Tech Net 1500", + }) // Prepare app app := &app.App{ diff --git a/pkg/classgrpc/class.go b/pkg/classgrpc/class.go index a0968d0..fb16f0d 100644 --- a/pkg/classgrpc/class.go +++ b/pkg/classgrpc/class.go @@ -1,3 +1,5 @@ +// Package classgrpc provides demonstrative rpc implementation for class server +// TODO: Move font and text to ClassServiceOpts in New() and use package classgrpc import ( @@ -11,17 +13,25 @@ import ( type ClassService struct { class.UnimplementedClassServiceServer - ctx context.Context + ctx context.Context + font class.Font + text string +} + +type ClassServiceOpts struct { + Ctx context.Context + Font class.Font + Text string } var DefaultFont = class.Font_FONT_BARBWIRE func (s *ClassService) GetClassLogo(ctx context.Context, req *class.GetClassLogoRequest) (*class.GetClassLogoResponse, error) { if req.GetFont() == class.Font_FONT_UNSPECIFIED { - req.Font = DefaultFont + req.Font = s.font } - f := figure.NewFigure("Indiana Tech", getFontString(req.GetFont()), false) + f := figure.NewFigure(s.text, getFontString(req.GetFont()), false) resp := &class.GetClassLogoResponse{ LogoBytes: []byte(f.String()), @@ -38,8 +48,10 @@ func getFontString(font class.Font) string { return strings.ToLower(strings.ReplaceAll(font.String(), "FONT_", "")) } -func New(ctx context.Context) *ClassService { +func New(opts *ClassServiceOpts) *ClassService { return &ClassService{ - ctx: ctx, + ctx: opts.Ctx, + font: opts.Font, + text: opts.Text, } }