Skip to content

Commit

Permalink
feat: support for specifying a space environment when creating a client
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Thomas committed Nov 15, 2024
1 parent 5834ea1 commit 2e5a02b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion foomo/gocontentful/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,14 @@ func (c *Command) execute(ctx context.Context, r *readline.Readline) error {
return errors.Wrap(err, string(out))
}

// "master" is the built-in default environment name of contentful
// fallback to it if the configuration does not ask specifically for an environment
if cfg.Environment == "" {
cfg.Environment = "master"
}

if err := shell.New(ctx, c.l, "gocontentful",
"-spaceid", cfg.SpaceID, "-cmakey", cfg.CMAKey,
"-spaceid", cfg.SpaceID, "-cmakey", cfg.CMAKey, "-environment", cfg.Environment,
"-contenttypes", strings.Join(cfg.ContentTypes, ","), dir).
Args(r.AdditionalArgs()...).
Run(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions foomo/gocontentful/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package gocontentful
type Config struct {
SpaceID string `yaml:"spaceId"`
CMAKey string `yaml:"cmaKey"`
Environment string `yaml:"environment,omitempty"`
ContentTypes []string `yaml:"contentTypes"`
}

0 comments on commit 2e5a02b

Please sign in to comment.