@cryptotaxi247 / kubo / commits / 67456e2e6

go-ipfs-config: Add config for downloading repo migrations

gammazero committed Apr 16, 2021 at 17:22 UTC 67456e2e647a28080259b6f38eb59b0a911070b4
3 files changed +27
config/config.go
+1
@@ -29,6 +29,7 @@ type Config struct {
29 Pubsub PubsubConfig
30 Peering Peering
31 DNS DNS
32 + Migration Migration
33
34 Provider Provider
35 Reprovider Reprovider
config/init.go
+4
@@ -92,6 +92,10 @@ func InitWithIdentity(identity Identity) (*Config, error) {
92 DNS: DNS{
93 Resolvers: map[string]string{},
94 },
95 + Migration: Migration{
96 + DownloadSources: DefaultMigrationDownloadSources,
97 + Keep: DefaultMigrationKeep,
98 + },
99 }
100
101 return conf, nil
config/migration.go new
+22
@@ -0,0 +1,22 @@
1 +package config
2 +
3 +import "github.com/libp2p/go-libp2p-core/peer"
4 +
5 +const DefaultMigrationKeep = "cache"
6 +
7 +var DefaultMigrationDownloadSources = []string{"HTTPS", "IPFS"}
8 +
9 +// Migration configures how migrations are downloaded and if the downloads are
10 +// added to IPFS locally
11 +type Migration struct {
12 + // Sources in order of preference where "HTTPS" means our gateways and
13 + // "IPFS" means over IPFS. Any other values are interpretes as hostnames
14 + // for custom gateways. An empty list means "do the default thing"
15 + DownloadSources []string
16 + // Whether or not to keep the migration after downloading it.
17 + // Options are "discard", "cache", "pin". Empty string for default.
18 + Keep string
19 + // Peers lists the nodes to attempt to connect with when downloading
20 + // migrations.
21 + Peers []peer.AddrInfo
22 +}