Skip to content
6 changes: 6 additions & 0 deletions apps/cli-go/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ type (
Functions FunctionConfig `toml:"functions" json:"functions"`
Analytics analytics `toml:"analytics" json:"analytics"`
Experimental experimental `toml:"experimental" json:"experimental"`
// Workers is parsed but never read here. The [workers] section is owned by
// the TS CLI; this field exists only so a config the TS schema accepts does
// not trip UnmarshalExact in the delegated Go child (`flags.LoadConfig`).
// The json tag is the one that matters: the decoder runs with
// dc.TagName = "json". Omitted from toml so Go never emits the section.
Workers map[string]any `toml:"-" json:"workers"`
}

config struct {
Expand Down
24 changes: 24 additions & 0 deletions apps/cli-go/pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,30 @@ enabled = false
require.NotNil(t, config.Experimental.PgDelta)
assert.False(t, config.Experimental.PgDelta.Enabled)
})

// [workers] is owned by the TS CLI, but the published JSON schema advertises it,
// so a user can hand-write it today. Every Go-delegated path goes through
// config.Load, and UnmarshalExact rejects keys baseConfig does not model — so the
// section has to at least parse here, in both base and remote position.
t.Run("accepts the TS-owned workers section", func(t *testing.T) {
config := NewConfig()
fsys := fs.MapFS{
"supabase/config.toml": &fs.MapFile{Data: []byte(`
project_id = "test"

[workers.api]
runtime = "node"

[remotes.prod]
project_id = "bvikqvbczudanvggcord"

[remotes.prod.workers.api]
instances = 3
`)},
}

assert.NoError(t, config.Load("", fsys))
})
}

func TestPgDeltaNpmVersionPinning(t *testing.T) {
Expand Down
Loading
Loading