-
Notifications
You must be signed in to change notification settings - Fork 0
feat: utils package for better DRY #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a shared utils package to centralize environment-variable mapping and Kubernetes ConfigMap creation, reducing duplication across the signet_node and builder modules.
- Add
pkg/utils/env.gowithCreateEnvMap,CreateConfigMap,CamelToSnake, and conversion helpers, plus corresponding tests. - Refactor
signet_nodeandbuilderpackages to useutils.CreateEnvMap/CreateConfigMapand implementEnvProvider, removing legacy helpers. - Update types, tests, and APIs (e.g.,
BuilderEnv.BuilderPortnow aStringInput) to align with the new utils.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/env.go | New DRY utilities for converting structs to env maps and ConfigMaps |
| pkg/utils/env_test.go | Tests covering CamelToSnake, getStringValue, CreateEnvMap, and interface usage |
| pkg/signet_node/types.go | Implement EnvProvider for SignetNodeEnv using the new utils |
| pkg/signet_node/signet_node.go | Replace manual ConfigMap creation with utils.CreateConfigMap |
| pkg/signet_node/helpers_test.go | Removed old env mapping tests (covered now in utils) |
| pkg/builder/types.go | Change BuilderEnv.BuilderPort to StringInput and add GetEnvMap |
| pkg/builder/validation_test.go | Update validation tests to use string port inputs |
| pkg/builder/builder.go | Use utils.CreateConfigMap and EnvFrom instead of manual env logic |
Comments suppressed due to low confidence (2)
pkg/signet_node/signet_node.go:91
- [nitpick] The name
exex-configmapis non-intuitive; consider renaming it to something likeexecution-configmapfor clarity.
"exex-configmap",
pkg/signet_node/helpers_test.go:7
- Tests for the new
EnvProviderbehavior inSignetNodeEnvwere removed; consider adding integration tests to ensureutils.CreateEnvMapproduces the expected environment variables forSignetNodeEnv.
import (
b7d5735 to
4bfa0b0
Compare
4741fb5 to
28c4e58
Compare
4bfa0b0 to
8cf02b7
Compare
8cf02b7 to
18bb794
Compare

No description provided.