Skip to content
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

uds config variable check only on deploy #641

Open
decleaver opened this issue May 28, 2024 · 0 comments
Open

uds config variable check only on deploy #641

decleaver opened this issue May 28, 2024 · 0 comments

Comments

@decleaver
Copy link
Collaborator

follow on to #618

Currently config validation is being done in the root init function which gets called before any command code.

The config code is going through variables and making sure they are uppercase, but this should only be done when running a deploy command. It is not needed for the other commands.

	for pkgName, pkgVar := range bundleCfg.DeployOpts.Variables {
		for varName, varValue := range pkgVar {
			// delete the lowercase var and replace with uppercase
			delete(bundleCfg.DeployOpts.Variables[pkgName], varName)
			bundleCfg.DeployOpts.Variables[pkgName][strings.ToUpper(varName)] = varValue
		}
	}

	// ensure the DeployOpts.SharedVariables vars are uppercase
	for varName, varValue := range bundleCfg.DeployOpts.SharedVariables {
		// delete the lowercase var and replace with uppercase
		delete(bundleCfg.DeployOpts.SharedVariables, varName)
		bundleCfg.DeployOpts.SharedVariables[strings.ToUpper(varName)] = varValue
	}

Possible solution:

  • calling the loadViperConfig function in the preRun for every command and refactoring the loadViperConfig function to take in the cmd that is being called. That cmd can then be used to to check if those for loops need to run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant