Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport release config changes #815

Merged
merged 3 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
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
24 changes: 17 additions & 7 deletions pkg/skyenv/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,24 @@ const (
PackageSkywirePath = "/opt/skywire"
)

// Constants for default services.
// Constants for old default services.
const (
DefaultTpDiscAddr = "http://transport.discovery.skywire.skycoin.com"
DefaultDmsgDiscAddr = "http://dmsg.discovery.skywire.skycoin.com"
DefaultServiceDiscAddr = "http://service.discovery.skycoin.com"
DefaultRouteFinderAddr = "http://routefinder.skywire.skycoin.com"
DefaultUptimeTrackerAddr = "http://uptime-tracker.skywire.skycoin.com"
DefaultAddressResolverAddr = "http://address.resolver.skywire.skycoin.com"
OldDefaultTpDiscAddr = "http://transport.discovery.skywire.skycoin.com"
OldDefaultDmsgDiscAddr = "http://dmsg.discovery.skywire.skycoin.com"
OldDefaultServiceDiscAddr = "http://service.discovery.skycoin.com"
OldDefaultRouteFinderAddr = "http://routefinder.skywire.skycoin.com"
OldDefaultUptimeTrackerAddr = "http://uptime-tracker.skywire.skycoin.com"
OldDefaultAddressResolverAddr = "http://address.resolver.skywire.skycoin.com"
)

// Constants for new default services.
const (
DefaultTpDiscAddr = "http://tpd.skywire.skycoin.com"
DefaultDmsgDiscAddr = "http://dmsgd.skywire.skycoin.com"
DefaultServiceDiscAddr = "http://sd.skycoin.com"
DefaultRouteFinderAddr = "http://rf.skywire.skycoin.com"
DefaultUptimeTrackerAddr = "http://ut.skywire.skycoin.com"
DefaultAddressResolverAddr = "http://ar.skywire.skycoin.com"
DefaultSetupPK = "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557"
)

Expand Down
7 changes: 6 additions & 1 deletion pkg/visor/visorconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ func MakeBaseConfig(common *Common) *V1 {
RouteFinderTimeout: DefaultTimeout,
}
conf.Launcher = &V1Launcher{
Discovery: nil,
Discovery: &V1AppDisc{
ServiceDisc: skyenv.DefaultServiceDiscAddr,
},
Apps: nil,
ServerAddr: skyenv.DefaultAppSrvAddr,
BinPath: skyenv.DefaultAppBinPath,
}
conf.UptimeTracker = &V1UptimeTracker{
Addr: skyenv.DefaultUptimeTrackerAddr,
}
conf.CLIAddr = skyenv.DefaultRPCAddr
conf.LogLevel = skyenv.DefaultLogLevel
conf.LocalPath = skyenv.DefaultLocalPath
Expand Down
24 changes: 24 additions & 0 deletions pkg/visor/visorconfig/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func Parse(log *logging.MasterLogger, path string, raw []byte) (*V1, error) {
// parse any v1-compatible version with v1 parse procedure
case V110Name:
fallthrough
case V101Name:
return parseV1(cc, raw)
case V100Name:
return parseV1(cc, raw)
case V0Name, V0NameOldFormat, "":
Expand All @@ -56,6 +58,7 @@ func parseV1(cc *Common, raw []byte) (*V1, error) {
if err := conf.ensureKeys(); err != nil {
return nil, fmt.Errorf("%v: %w", ErrInvalidSK, err)
}
conf = updateUrls(conf)
conf.Version = V1Name
return conf, conf.flush(conf)
}
Expand Down Expand Up @@ -155,3 +158,24 @@ func parseV0(cc *Common, raw []byte) (*V1, error) {

return conf, conf.flush(conf)
}
func updateUrls(conf *V1) *V1 {
if conf.Dmsg.Discovery == skyenv.OldDefaultDmsgDiscAddr {
conf.Dmsg.Discovery = skyenv.DefaultDmsgDiscAddr
}
if conf.Transport.Discovery == skyenv.OldDefaultTpDiscAddr {
conf.Transport.Discovery = skyenv.DefaultTpDiscAddr
}
if conf.Transport.AddressResolver == skyenv.OldDefaultAddressResolverAddr {
conf.Transport.AddressResolver = skyenv.DefaultAddressResolverAddr
}
if conf.Routing.RouteFinder == skyenv.OldDefaultRouteFinderAddr {
conf.Routing.RouteFinder = skyenv.DefaultRouteFinderAddr
}
if conf.UptimeTracker.Addr == skyenv.OldDefaultUptimeTrackerAddr {
conf.UptimeTracker.Addr = skyenv.DefaultUptimeTrackerAddr
}
if conf.Launcher.Discovery.ServiceDisc == skyenv.OldDefaultServiceDiscAddr {
conf.Launcher.Discovery.ServiceDisc = skyenv.DefaultServiceDiscAddr
}
return conf
}
4 changes: 4 additions & 0 deletions pkg/visor/visorconfig/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import (
// V100Name is the semantic version string for v1.0.0.
const V100Name = "v1.0.0"

// V101Name is the semantic version string for v1.0.1.
const V101Name = "v1.0.1"

// V110Name is the semantic version string for v1.1.0.
// Added MinHops field to V1Routing section of config
// Removed public_trusted_visor field from root section
Expand All @@ -25,6 +28,7 @@ const V100Name = "v1.0.0"
// Added public_autoconnect field to transport section
// Added transport_setup_nodes field to transport section
// Removed authorization_file field from dmsgpty section
// Default urls are changed to newer shortned ones
const V110Name = "v1.1.0"

// V1Name is the semantic version string for the most recent version of V1.
Expand Down