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

fix dmsghttp-config.json file path in skywire config #1114

Merged
merged 2 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/config/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ var genConfigCmd = &cobra.Command{
// Use dmsg urls for services and add dmsg-servers
if dmsgHTTP {
var dmsgHTTPServersList visorconfig.DmsgHTTPServers
serversListJSON, err := ioutil.ReadFile("dmsghttp-config.json")
serversListJSON, err := ioutil.ReadFile(conf.DMSGHTTPPath)
if err != nil {
logger.WithError(err).Fatal("Failed to read servers.json file.")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-visor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func runVisor(args []string) {

if netutil.LocalProtocol() {
var dmsgHTTPServersList visorconfig.DmsgHTTPServers
serversListJSON, err := ioutil.ReadFile("dmsghttp-config.json")
serversListJSON, err := ioutil.ReadFile(conf.DMSGHTTPPath)
if err != nil {
log.WithError(err).Fatal("Failed to read servers.json file.")
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/skyenv/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ const (
DefaultLocalPath = DefaultSkywirePath + "/local"
)

// Default dmsghttp config constants
const (
DefaultDMSGHTTPPath = DefaultSkywirePath + "/dmsghttp-config.json"
)

// Default hypervisor constants
const (
DefaultHypervisorDB = ".skycoin/hypervisor/users.db"
Expand Down Expand Up @@ -183,6 +188,11 @@ func PackageAppBinPath() string {
return filepath.Join(appBinPath(), "apps")
}

// PackageDMSGHTTPPath gets dmsghttp path for installed Skywire.
func PackageDMSGHTTPPath() string {
return filepath.Join(appBinPath(), "dmsghttp-config.json")
}

// PackageTpLogStore gets transport logs path for installed Skywire.
func PackageTpLogStore() string {
return filepath.Join(PackageSkywirePath(), "transport_logs")
Expand Down
2 changes: 2 additions & 0 deletions pkg/visor/visorconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func MakeBaseConfig(common *Common) *V1 {
conf.StunServers = skyenv.GetStunServers()
conf.ShutdownTimeout = DefaultTimeout
conf.RestartCheckDelay = Duration(restart.DefaultCheckDelay)
conf.DMSGHTTPPath = skyenv.DefaultDMSGHTTPPath
return conf
}

Expand Down Expand Up @@ -132,6 +133,7 @@ func MakePackageConfig(log *logging.MasterLogger, confPath string, sk *cipher.Se
}
conf.LocalPath = skyenv.PackageAppLocalPath()
conf.Launcher.BinPath = skyenv.PackageAppBinPath()
conf.DMSGHTTPPath = skyenv.PackageDMSGHTTPPath()

if conf.Hypervisor != nil {
conf.Hypervisor.EnableAuth = skyenv.DefaultPackageEnableAuth
Expand Down
1 change: 1 addition & 0 deletions pkg/visor/visorconfig/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type V1 struct {
ShutdownTimeout Duration `json:"shutdown_timeout,omitempty"` // time value, examples: 10s, 1m, etc
RestartCheckDelay Duration `json:"restart_check_delay,omitempty"` // time value, examples: 10s, 1m, etc
IsPublic bool `json:"is_public"`
DMSGHTTPPath string `json:"dmsghttp_path"`

PersistentTransports []transport.PersistentTransports `json:"persistent_transports"`

Expand Down