Clean up how settings are handled

This commit is contained in:
Ian Howell 2019-05-02 09:15:32 -05:00
parent d26c6c76a1
commit b672281dcf
3 changed files with 6 additions and 8 deletions

View File

@ -5,10 +5,12 @@ import (
"io"
"os"
"github.com/ian-howell/airshipadm/pkg/settings"
"github.com/ian-howell/airshipadm/pkg/environment"
"github.com/spf13/cobra"
)
var settings environment.AirshipADMSettings
// NewRootCmd creates the root `airshipadm` command. All other commands are
// subcommands branching from this one
func NewRootCmd(out io.Writer) *cobra.Command {
@ -23,7 +25,7 @@ func NewRootCmd(out io.Writer) *cobra.Command {
// Compound commands
rootCmd.AddCommand(NewWorkflowCommand())
rootCmd.PersistentFlags().StringVar(&settings.Settings.KubeConfigFilePath, "kubeconfig", "", "path to kubeconfig")
rootCmd.PersistentFlags().StringVar(&settings.KubeConfigFilePath, "kubeconfig", "", "path to kubeconfig")
return rootCmd
}

View File

@ -8,7 +8,6 @@ import (
"github.com/spf13/cobra"
kube "github.com/ian-howell/airshipadm/pkg/kube"
"github.com/ian-howell/airshipadm/pkg/settings"
)
const versionLong = `Show the versions for the airshipadm tool and the supporting tools.
@ -29,7 +28,7 @@ func NewVersionCommand(out io.Writer) *cobra.Command {
Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintf(out, "%-10s: %s\n", "airshipadm", airshipadmVersion())
fmt.Fprintf(out, "%-10s: %s\n", "golang", runtime.Version())
fmt.Fprintf(out, "%-10s: %s\n", "kubernetes", kubeVersion(settings.Settings.KubeConfigFilePath))
fmt.Fprintf(out, "%-10s: %s\n", "kubernetes", kubeVersion(settings.KubeConfigFilePath))
fmt.Fprintf(out, "%-10s: %s\n", "helm", helmVersion())
fmt.Fprintf(out, "%-10s: %s\n", "argo", argoVersion())
},

View File

@ -1,7 +1,4 @@
package settings
// Settings contains all of the configuration required by airshipadm
var Settings = new(AirshipADMSettings)
package environment
// AirshipADMSettings is a container for all of the settings needed by airshipadm
type AirshipADMSettings struct {