mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Build / docker-build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
https://github.com/ipfs/kubo/pull/10883 https://github.com/ipshipyard/config.ipfs-mainnet.org/issues/3 --------- Co-authored-by: gammazero <gammazero@users.noreply.github.com>
64 lines
1.7 KiB
Go
64 lines
1.7 KiB
Go
// Package main implements fs-repo-16-to-17 migration for IPFS repositories.
|
|
//
|
|
// This migration transitions repositories from version 16 to 17, introducing
|
|
// the AutoConf system that replaces hardcoded network defaults with dynamic
|
|
// configuration fetched from autoconf.json.
|
|
//
|
|
// Changes made:
|
|
// - Enables AutoConf system with default settings
|
|
// - Migrates default bootstrap peers to "auto" sentinel value
|
|
// - Sets DNS.Resolvers["."] to "auto" for dynamic DNS resolver configuration
|
|
// - Migrates Routing.DelegatedRouters to ["auto"]
|
|
// - Migrates Ipns.DelegatedPublishers to ["auto"]
|
|
// - Preserves user customizations (custom bootstrap peers, DNS resolvers)
|
|
//
|
|
// The migration is reversible and creates config.16-to-17.bak for rollback.
|
|
//
|
|
// Usage:
|
|
//
|
|
// fs-repo-16-to-17 -path /path/to/ipfs/repo [-verbose] [-revert]
|
|
//
|
|
// This migration is embedded in Kubo starting from version 0.37 and runs
|
|
// automatically during daemon startup. This standalone binary is provided
|
|
// for manual migration scenarios.
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
mg16 "github.com/ipfs/kubo/repo/fsrepo/migrations/fs-repo-16-to-17/migration"
|
|
)
|
|
|
|
func main() {
|
|
var path = flag.String("path", "", "Path to IPFS repository")
|
|
var verbose = flag.Bool("verbose", false, "Enable verbose output")
|
|
var revert = flag.Bool("revert", false, "Revert migration")
|
|
flag.Parse()
|
|
|
|
if *path == "" {
|
|
fmt.Fprintf(os.Stderr, "Error: -path flag is required\n")
|
|
flag.Usage()
|
|
os.Exit(1)
|
|
}
|
|
|
|
m := mg16.Migration{}
|
|
opts := mg16.Options{
|
|
Path: *path,
|
|
Verbose: *verbose,
|
|
}
|
|
|
|
var err error
|
|
if *revert {
|
|
err = m.Revert(opts)
|
|
} else {
|
|
err = m.Apply(opts)
|
|
}
|
|
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Migration failed: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|