Skip to content

Commit

Permalink
Merge pull request #1 from Skyfleet/fix/default-settings
Browse files Browse the repository at this point in the history
change default settings
  • Loading branch information
0pcom authored Nov 3, 2020
2 parents 42821d3 + 9995a94 commit bb89dcb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
21 changes: 10 additions & 11 deletions pkg/skyenv/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

// Constants for skywire root directories.
const (
DefaultSkywirePath = "/opt/skywire"
TestSkywirePath = "."
DefaultSkywirePath = "."
PackageSkywirePath = "/opt/skywire"
)

// Constants for default services.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions pkg/visor/hypervisorconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
27 changes: 19 additions & 8 deletions pkg/visor/visorconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

0 comments on commit bb89dcb

Please sign in to comment.