Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions internal/cli/snapshot_publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/openbootdotdev/openboot/internal/auth"
"github.com/openbootdotdev/openboot/internal/config"
"github.com/openbootdotdev/openboot/internal/httputil"
"github.com/openbootdotdev/openboot/internal/snapshot"
syncpkg "github.com/openbootdotdev/openboot/internal/sync"
Expand Down Expand Up @@ -51,6 +52,14 @@ func publishSnapshot(ctx context.Context, snap *snapshot.Snapshot, explicitSlug
if targetSlug != "" {
fmt.Fprintln(os.Stderr)
fmt.Fprintf(os.Stderr, " Publishing to @%s/%s (updating)\n", stored.Username, targetSlug)
// PUT endpoint requires name; fetch the existing config to preserve it.
userSlug := fmt.Sprintf("%s/%s", stored.Username, targetSlug)
if rc, fetchErr := config.FetchRemoteConfig(userSlug, stored.Token); fetchErr == nil {
configName = rc.Name
}
if configName == "" {
configName = targetSlug
}
} else {
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, " Publishing as a new config on openboot.dev")
Expand Down
Loading