Skip to content

Commit

Permalink
Merge pull request #38 from SkycoinProject/feature/config_testing_flag
Browse files Browse the repository at this point in the history
Add flag to select deployment and update default deployment
  • Loading branch information
志宇 authored Oct 21, 2019
2 parents 73aad12 + 0d7cbf1 commit d0ef5a3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
22 changes: 19 additions & 3 deletions cmd/skywire-cli/commands/node/gen-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ var (
output string
replace bool
configLocType = pathutil.WorkingDirLoc
testenv bool
)

func init() {
genConfigCmd.Flags().StringVarP(&output, "output", "o", "", "path of output config file. Uses default of 'type' flag if unspecified.")
genConfigCmd.Flags().BoolVarP(&replace, "replace", "r", false, "whether to allow rewrite of a file that already exists.")
genConfigCmd.Flags().VarP(&configLocType, "type", "m", fmt.Sprintf("config generation mode. Valid values: %v", pathutil.AllConfigLocationTypes()))
genConfigCmd.Flags().BoolVarP(&testenv, "testing-environment", "t", false, "whether to use production or test deployment service.")
}

var genConfigCmd = &cobra.Command{
Expand Down Expand Up @@ -84,7 +86,12 @@ func defaultConfig() *visor.Config {
conf.Node.StaticPubKey = pk
conf.Node.StaticSecKey = sk

conf.Messaging.Discovery = skyenv.DefaultDmsgDiscAddr
if testenv {
conf.Messaging.Discovery = skyenv.TestDmsgDiscAddr
} else {
conf.Messaging.Discovery = skyenv.DefaultDmsgDiscAddr
}

conf.Messaging.ServerCount = 1

// TODO(evanlinjin): We have disabled skyproxy passcode by default for now - We should make a cli arg for this.
Expand All @@ -98,11 +105,20 @@ func defaultConfig() *visor.Config {
}
conf.TrustedNodes = []cipher.PubKey{}

conf.Transport.Discovery = skyenv.DefaultTpDiscAddr
if testenv {
conf.Transport.Discovery = skyenv.TestTpDiscAddr
} else {
conf.Transport.Discovery = skyenv.DefaultTpDiscAddr
}

conf.Transport.LogStore.Type = "file"
conf.Transport.LogStore.Location = "./skywire/transport_logs"

conf.Routing.RouteFinder = skyenv.DefaultRouteFinderAddr
if testenv {
conf.Routing.RouteFinder = skyenv.TestRouteFinderAddr
} else {
conf.Routing.RouteFinder = skyenv.DefaultRouteFinderAddr
}

var sPK cipher.PubKey
if err := sPK.UnmarshalText([]byte(skyenv.DefaultSetupPK)); err != nil {
Expand Down
13 changes: 10 additions & 3 deletions internal/skyenv/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ package skyenv

// Constants for default services.
const (
DefaultTpDiscAddr = "http://transport.discovery.skywire.cc"
DefaultDmsgDiscAddr = "http://dmsg.discovery.skywire.cc"
DefaultRouteFinderAddr = "http://routefinder.skywire.cc"
DefaultTpDiscAddr = "http://transport.discovery.skywire.skycoin.com"
DefaultDmsgDiscAddr = "http://dmsg.discovery.skywire.skycoin.com"
DefaultRouteFinderAddr = "http://routefinder.skywire.skycoin.com"
DefaultSetupPK = "026c5a07de617c5c488195b76e8671bf9e7ee654d0633933e202af9e111ffa358d"
)

// Constants for testing deployment.
const (
TestTpDiscAddr = "http://transport.discovery.skywire.cc"
TestDmsgDiscAddr = "http://dmsg.discovery.skywire.cc"
TestRouteFinderAddr = "http://routefinder.skywire.cc"
)

// Common app constants.
const (
AppProtocolVersion = "0.0.1"
Expand Down
16 changes: 12 additions & 4 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# github.com/SkycoinProject/dmsg v0.0.0-20191015061558-709ec3a1f4f5

# github.com/SkycoinProject/dmsg v0.0.0-20190918181704-b7cccca1451e

github.com/SkycoinProject/dmsg
github.com/SkycoinProject/dmsg/cipher
github.com/SkycoinProject/dmsg/disc
Expand Down Expand Up @@ -85,7 +87,9 @@ github.com/stretchr/testify/assert
github.com/stretchr/testify/require
# go.etcd.io/bbolt v1.3.3
go.etcd.io/bbolt
# golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550

# golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad

golang.org/x/crypto/blake2b
golang.org/x/crypto/blake2s
golang.org/x/crypto/chacha20poly1305
Expand All @@ -94,12 +98,16 @@ golang.org/x/crypto/internal/chacha20
golang.org/x/crypto/internal/subtle
golang.org/x/crypto/poly1305
golang.org/x/crypto/ssh/terminal
# golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582

# golang.org/x/net v0.0.0-20190926025831-c00fd9afed17

golang.org/x/net/context
golang.org/x/net/internal/socks
golang.org/x/net/nettest
golang.org/x/net/proxy
# golang.org/x/sys v0.0.0-20191010194322-b09406accb47

# golang.org/x/sys v0.0.0-20190927073244-c990c680b611

golang.org/x/sys/cpu
golang.org/x/sys/unix
golang.org/x/sys/windows
Expand Down

0 comments on commit d0ef5a3

Please sign in to comment.