Update from a git repository
router.update.repository names a public repository whose tags vX.Y.Z are releases. router-update check (daily, and from the Updates page) looks for a newer one and the Overview says so; router-update --git builds the router from a tag like a bundle update: the settings are migrated, the new version must be confirmed, the nixpkgs pin stays. The flake of such a router comes from the release's config-flake.nix. The global flake registry is off. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -93,7 +93,10 @@ func (s Settings) channel() string { return str(s, "router", "update", "channel"
|
||||
// setChannel changes router.update.channel in settings.json and, since it takes
|
||||
// effect when upgrading rather than when applying, in the confirmed settings
|
||||
// too, so it does not show up as an unapplied change.
|
||||
func (sys System) setChannel(channel string) error {
|
||||
func (sys System) setChannel(channel string) error { return sys.setUpdateField("channel", channel) }
|
||||
|
||||
// setUpdateField does that for a key of router.update ("" removes it).
|
||||
func (sys System) setUpdateField(key, value string) error {
|
||||
set := func(path string, required bool) error {
|
||||
s, err := loadSettings(path)
|
||||
if err != nil {
|
||||
@@ -103,15 +106,15 @@ func (sys System) setChannel(channel string) error {
|
||||
return err
|
||||
}
|
||||
router := obj(s, "router")
|
||||
if channel == "" {
|
||||
if value == "" {
|
||||
if u, ok := router["update"].(map[string]any); ok {
|
||||
delete(u, "channel")
|
||||
delete(u, key)
|
||||
if len(u) == 0 {
|
||||
delete(router, "update")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
obj(router, "update")["channel"] = channel
|
||||
obj(router, "update")[key] = value
|
||||
}
|
||||
return s.save(path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user