feat: added config implementation using viper

This commit is contained in:
David Allen 2025-09-15 15:52:42 -06:00
parent 7713c2e55d
commit 481a0782c5
Signed by: towk
GPG key ID: 0430CDBE22619155
6 changed files with 215 additions and 64 deletions

View file

@ -49,6 +49,7 @@ var downloadCmd = cobra.Command{
host, _ = cmd.Flags().GetString("host")
path, _ = cmd.Flags().GetString("path")
outputPath, _ = cmd.Flags().GetString("output")
configPath, _ = cmd.Flags().GetString("config")
cacertPath, _ = cmd.Flags().GetString("cacert")
pluginNames, _ = cmd.Flags().GetStringSlice("plugins")
profileIDs, _ = cmd.Flags().GetStringSlice("profiles")
@ -62,6 +63,7 @@ var downloadCmd = cobra.Command{
err error
)
// build download query URL
query = fmt.Sprintf("/download/%s?", path)
if len(pluginNames) > 0 {
query += "plugins=" + url.QueryEscape(strings.Join(pluginNames, ","))
@ -79,6 +81,7 @@ var downloadCmd = cobra.Command{
log.Debug().
Str("host", host).
Str("path", path).
Str("config", configPath).
Str("query", query).
Str("output", outputPath).
Strs("profiles", profileIDs).