-
Notifications
You must be signed in to change notification settings - Fork 17
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
cli: instantiate viper and swagger client in root command instead of using singletons #76
Comments
The problem with this approach is that the api client uses viper to get the server URL. This means we'll have to pass the viper instance through every command to then pass it to the client, which probably defeats the point of the issue. We should find another solution for the api client. Maybe we could instantiate the api client in root and pass the client to all the commands |
Draft PR #119 showcases how this could look like and initiates a discussion on whether it's worth it or not |
Currently, some tests are having problems because the client and viper were used as singletons. It'd be better to instantiate them once in
newRootCmd()
and pass them to the commands that need them, facilitating the way unit tests are done as well.The text was updated successfully, but these errors were encountered: