feat: solve secrets on config and backends setup data #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to the
agent
package, focusing on refactoring, adding new functionality for environment variable resolution, and updating tests. The most important changes include modifying thestartBackends
method to accept additional parameters, adding new functions to resolve environment variables, and updating the configuration manager to use these new functions.Refactoring and Enhancements:
agent/agent.go
: Modified thestartBackends
method to acceptcfgBackends
andlabels
as parameters instead of usinga.config.OrbAgent.Backends
anda.config.OrbAgent.Labels
directly. Also, updated theStart
method to solve configuration secrets before starting backends. [1] [2] [3]Environment Variable Resolution:
agent/config/env.go
: Added new functionsResolveEnv
,ResolveEnvInMap
, andResolveEnvInSlice
to handle environment variable resolution within strings, maps, and slices.agent/config/config_test.go
: Added comprehensive tests for the new environment variable resolution functions.Configuration Manager Updates:
agent/configmgr/git.go
: Updated the Git configuration manager to use the newconfig.ResolveEnv
function for resolving environment variables. Removed the oldresolveEnv
function. [1] [2] [3]agent/configmgr/manager.go
: Modified theNew
function to accept anactive
string parameter instead of aconfig.ManagerConfig
object.Test Updates:
agent/agent_prof_test.go
: Removed theTest_orbAgent_startBackends
test as it was outdated and not providing value.agent/configmgr/git_test.go
,agent/configmgr/local_test.go
,agent/configmgr/manager_test.go
: Updated tests to reflect changes in the configuration manager initialization and environment variable resolution. [1] [2] [3] [4] [5] [6] [7] [8]Policy Manager Updates:
agent/policymgr/manager.go
: Updated the policy manager to useSolvePolicySecrets
instead ofSolveSecrets
and the callback registration method toRegisterUpdatePoliciesCallback
. [1] [2] [3]agent/policymgr/manager_test.go
: Updated mock methods to reflect changes in the policy manager.