jpictl: only load Machine.PublicAddresses for jpictl dump

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-28 15:48:38 +00:00
parent 94daf5ad59
commit 6e46d23b45
4 changed files with 7 additions and 5 deletions
+4 -2
View File
@@ -14,6 +14,8 @@ var cfg = &Config{
}
// LoadZones loads all zones and machines in the config directory
func (cfg *Config) LoadZones() (*zones.Zones, error) {
return zones.New(cfg.Base, cfg.Domain)
func (cfg *Config) LoadZones(resolve bool) (*zones.Zones, error) {
return zones.New(cfg.Base, cfg.Domain,
zones.ResolvePublicAddresses(resolve),
)
}
+1 -1
View File
@@ -58,7 +58,7 @@ var dumpCmd = &cobra.Command{
var buf bytes.Buffer
var enc Encoder
m, err := cfg.LoadZones()
m, err := cfg.LoadZones(true)
if err != nil {
return err
}
+1 -1
View File
@@ -11,7 +11,7 @@ var envCmd = &cobra.Command{
Use: "env",
Short: "generates environment variables for shell scripts",
RunE: func(_ *cobra.Command, _ []string) error {
m, err := cfg.LoadZones()
m, err := cfg.LoadZones(false)
if err != nil {
return err
}
+1 -1
View File
@@ -9,7 +9,7 @@ var writeCmd = &cobra.Command{
Use: "write",
Short: "rewrites all config files",
RunE: func(_ *cobra.Command, _ []string) error {
m, err := cfg.LoadZones()
m, err := cfg.LoadZones(false)
if err != nil {
return err
}