Signed-off-by: Alejandro Mery <amery@jpi.io>
@ -1,5 +1,7 @@
package main
import "git.jpi.io/amery/jpictl/pkg/zones"
// Config describes the repository
type Config struct {
Base string
@ -10,3 +12,8 @@ var cfg = &Config{
Base: "./m",
Domain: "m.jpi.cloud",
}
// LoadZones loads all zones and machines in the config directory
func (cfg *Config) LoadZones() (*zones.Zones, error) {
return zones.New(cfg.Base, cfg.Domain)
@ -9,8 +9,6 @@ import (
"github.com/burntSushi/toml"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
"git.jpi.io/amery/jpictl/pkg/zones"
)
// Encoder represents an object that encodes another internally
@ -60,7 +58,7 @@ var dumpCmd = &cobra.Command{
var buf bytes.Buffer
var enc Encoder
m, err := zones.New(cfg.Base, cfg.Domain)
m, err := cfg.LoadZones()
if err != nil {
return err
@ -4,8 +4,6 @@ import (
"os"
// Command
@ -13,7 +11,7 @@ var envCmd = &cobra.Command{
Use: "env",
Short: "generates environment variables for shell scripts",
RunE: func(_ *cobra.Command, _ []string) error {