Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Add config for downloading repo migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Apr 17, 2021
1 parent d75a8c6 commit 2d928b2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Config struct {
Pubsub PubsubConfig
Peering Peering
DNS DNS
Migration Migration

Provider Provider
Reprovider Reprovider
Expand Down
4 changes: 4 additions & 0 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ func InitWithIdentity(identity Identity) (*Config, error) {
DNS: DNS{
Resolvers: map[string]string{},
},
Migration: Migration{
DownloadSources: DefaultMigrationDownloadSources,
Keep: DefaultMigrationKeep,
},
}

return conf, nil
Expand Down
22 changes: 22 additions & 0 deletions migration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package config

import "github.com/libp2p/go-libp2p-core/peer"

const DefaultMigrationKeep = "cache"

var DefaultMigrationDownloadSources = []string{"HTTPS", "IPFS"}

// Migration configures how migrations are downloaded and if the downloads are
// added to IPFS locally
type Migration struct {
// Sources in order of preference where "HTTPS" means our gateways and
// "IPFS" means over IPFS. Any other values are interpretes as hostnames
// for custom gateways. An empty list means "do the default thing"
DownloadSources []string
// Whether or not to keep the migration after downloading it.
// Options are "discard", "cache", "pin". Empty string for default.
Keep string
// Peers lists the nodes to attempt to connect with when downloading
// migrations.
Peers []peer.AddrInfo
}

0 comments on commit 2d928b2

Please sign in to comment.