diff --git a/pkg/skyenv/values.go b/pkg/skyenv/values.go index ab82607900..acb5914ed8 100644 --- a/pkg/skyenv/values.go +++ b/pkg/skyenv/values.go @@ -8,8 +8,8 @@ import ( // Constants for skywire root directories. const ( - DefaultSkywirePath = "/opt/skywire" - TestSkywirePath = "." + DefaultSkywirePath = "." + PackageSkywirePath = "/opt/skywire" ) // Constants for default services. @@ -51,7 +51,7 @@ const ( DefaultDmsgPtyCLINet = "unix" DefaultDmsgPtyCLIAddr = "/tmp/dmsgpty.sock" DefaultDmsgPtyWhitelist = DefaultSkywirePath + "/dmsgpty/whitelist.json" - TestDmsgPtyWhiteList = TestSkywirePath + "/dmsgpty/whitelist.json" + PackageDmsgPtyWhiteList = PackageSkywirePath + "/dmsgpty/whitelist.json" ) // Default STCP constants. @@ -95,27 +95,26 @@ const ( DefaultAppLocalPath = DefaultSkywirePath + "/local" DefaultAppBinPath = DefaultSkywirePath + "/apps" DefaultLogLevel = "info" - TestAppLocalPath = TestSkywirePath + "/local" - TestAppBinPath = TestSkywirePath + "/apps" + PackageAppLocalPath = PackageSkywirePath + "/local" + PackageAppBinPath = PackageSkywirePath + "/apps" ) // Default routing constants const ( DefaultTpLogStore = DefaultSkywirePath + "/transport_logs" - TestTpLogStore = TestSkywirePath + "/transport_logs" + PackageTpLogStore = PackageSkywirePath + "/transport_logs" ) // Default hypervisor constants const ( DefaultHypervisorDB = ".skycoin/hypervisor/users.db" DefaultEnableAuth = true - DefaultEnableTLS = true + DefaultEnableTLS = false DefaultTLSKey = DefaultSkywirePath + "/ssl/key.pem" DefaultTLSCert = DefaultSkywirePath + "/ssl/cert.pem" - TestEnableAuth = false - TestEnableTLS = false - TestTLSKey = "" - TestTLSCert = "" + PackageEnableTLS = true + PackageTLSKey = PackageSkywirePath + "/ssl/key.pem" + PackageTLSCert = PackageSkywirePath + "/ssl/cert.pem" ) // MustPK unmarshals string PK to cipher.PubKey. It panics if unmarshaling fails. diff --git a/pkg/visor/hypervisorconfig/config.go b/pkg/visor/hypervisorconfig/config.go index 6527d226d8..5aab5018c0 100644 --- a/pkg/visor/hypervisorconfig/config.go +++ b/pkg/visor/hypervisorconfig/config.go @@ -123,6 +123,14 @@ func (c *Config) FillDefaults(testEnv bool) { } c.Cookies.FillDefaults() + + c.EnableAuth = skyenv.DefaultEnableAuth + + c.EnableTLS = skyenv.DefaultEnableTLS + + c.TLSCertFile = skyenv.DefaultTLSCert + c.TLSKeyFile = skyenv.DefaultTLSKey + } // Parse parses the file in path, and decodes to the config. diff --git a/pkg/visor/visorconfig/config.go b/pkg/visor/visorconfig/config.go index 5213259a40..edbe0e748e 100644 --- a/pkg/visor/visorconfig/config.go +++ b/pkg/visor/visorconfig/config.go @@ -153,11 +153,6 @@ func MakeTestConfig(log *logging.MasterLogger, confPath string, sk *cipher.SecKe conf.Hypervisor.DmsgDiscovery = conf.Transport.Discovery } - conf.Dmsgpty.AuthFile = skyenv.TestDmsgPtyWhiteList - conf.Transport.LogStore.Location = skyenv.TestTpLogStore - conf.Launcher.LocalPath = skyenv.TestAppLocalPath - conf.Launcher.BinPath = skyenv.TestAppBinPath - return conf, nil } @@ -167,11 +162,27 @@ func MakePackageConfig(log *logging.MasterLogger, confPath string, sk *cipher.Se if err != nil { return nil, err } + + conf.Dmsgpty = &V1Dmsgpty{ + Port: skyenv.DmsgPtyPort, + AuthFile: skyenv.PackageDmsgPtyWhiteList, + CLINet: skyenv.DefaultDmsgPtyCLINet, + CLIAddr: skyenv.DefaultDmsgPtyCLIAddr, + } + + conf.Transport.LogStore = &V1LogStore{ + Type: "file", + Location: skyenv.PackageTpLogStore, + } + + conf.Launcher.BinPath = skyenv.PackageAppBinPath + conf.Launcher.LocalPath = skyenv.PackageAppLocalPath + if conf.Hypervisor != nil { conf.Hypervisor.EnableAuth = skyenv.DefaultEnableAuth - conf.Hypervisor.EnableTLS = skyenv.DefaultEnableTLS - conf.Hypervisor.TLSKeyFile = skyenv.DefaultTLSKey - conf.Hypervisor.TLSCertFile = skyenv.DefaultTLSCert + conf.Hypervisor.EnableTLS = skyenv.PackageEnableTLS + conf.Hypervisor.TLSKeyFile = skyenv.PackageTLSKey + conf.Hypervisor.TLSCertFile = skyenv.PackageTLSCert } return conf, nil }