From b1be8e9ee820ed5fae0bbe6a66a36a3b84ce6e68 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 12 Apr 2015 17:51:38 -0700 Subject: [PATCH] command/meta: can force config --- command/meta.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/command/meta.go b/command/meta.go index adcc013552..51e382268a 100644 --- a/command/meta.go +++ b/command/meta.go @@ -31,10 +31,13 @@ const ( // Meta contains the meta-options and functionality that nearly every // Vault command inherits. type Meta struct { - Address string // Address to force for API clients ClientToken string Ui cli.Ui + // The things below can be set, but aren't common + ForceAddress string // Address to force for API clients + ForceConfig *Config // Force a config, don't load from disk + // These are set by the command line flags. flagAddress string flagCACert string @@ -56,8 +59,8 @@ func (m *Meta) Client() (*api.Client, error) { if m.flagAddress != "" { config.Address = m.flagAddress } - if m.Address != "" { - config.Address = m.Address + if m.ForceAddress != "" { + config.Address = m.ForceAddress } // If we need custom TLS configuration, then set it @@ -118,6 +121,9 @@ func (m *Meta) Config() (*Config, error) { if m.config != nil { return m.config, nil } + if m.ForceConfig != nil { + return m.ForceConfig, nil + } var err error m.config, err = LoadConfig("")