Skip to content

chore: remove viper dependency and simplify yaml parser #91

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

Merged
merged 2 commits into from
Apr 8, 2025

Conversation

leoparente
Copy link
Contributor

This pull request includes several changes to the orb-agent project, focusing on improving configuration handling, updating dependencies, and removing redundant code. The most important changes include switching from viper to yaml for configuration management, updating type definitions, and cleaning up unused backend-specific variables.

Configuration Management:

  • agent/agent.go, cmd/main.go: Replaced viper with yaml for configuration handling, including functions for loading and parsing YAML configuration files. [1] [2] [3]

Type Definitions:

  • agent/config/types.go: Updated struct tags from mapstructure to yaml for consistency with the new configuration handling approach. [1] [2]
  • agent/backend/backend.go: Changed map[string]interface{} to map[string]any for better type safety and readability.

Code Cleanup:

  • Removed backend-specific variable registration functions and their dependencies, as they are no longer needed with the new configuration approach. [1] [2] [3] [4] [5]

Dependency Updates:

  • go.mod: Updated dependencies, including adding new ones for yaml and removing viper and mapstructure. [1] [2] [3]

Test Adjustments:

  • Updated tests to reflect changes in configuration handling and type definitions. [1] [2] [3] [4]

These changes collectively improve the maintainability and readability of the codebase while ensuring better configuration management.

@leoparente leoparente self-assigned this Apr 8, 2025
Copy link

github-actions bot commented Apr 8, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent 0.0% 1 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend 0.0% 0 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 77.7% 2 0 0
🟢 PASS 0.00s github.com/netboxlabs/orb-agent/agent/backend/mocks 0.0% 0 0 0
🟢 PASS 4.02s github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 77.5% 2 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/otel 76.4% 2 0 0
🟢 PASS 3.02s github.com/netboxlabs/orb-agent/agent/backend/pktvisor 67.8% 2 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/worker 76.9% 2 0 0
🟢 PASS 1.06s github.com/netboxlabs/orb-agent/agent/configmgr 47.9% 9 0 0
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent/policies 100.0% 15 0 0
🟢 PASS 1.03s github.com/netboxlabs/orb-agent/agent/policymgr 70.3% 10 0 0
🟢 PASS 2.50s github.com/netboxlabs/orb-agent/agent/secretsmgr 51.8% 45 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/version 100.0% 1 0 0

Total coverage: 60.6%

@leoparente leoparente merged commit e3aadff into develop Apr 8, 2025
5 checks passed
@leoparente leoparente deleted the chore/remove-viper-dependency branch April 8, 2025 13:32
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants