Skip to content

Commit

Permalink
Merge pull request #471 from Darkren/fix/setting-proxy-settings
Browse files Browse the repository at this point in the history
Fix setting proxy settings
  • Loading branch information
jdknives authored Aug 14, 2020
2 parents fecd744 + a288842 commit c7ae857
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
11 changes: 9 additions & 2 deletions pkg/app/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ func (l *Launcher) ResetConfig(conf Config) {
apps[ac.Name] = ac
}
l.apps = apps
l.conf = conf

// we shouldn't change directories of apps, it causes
// all kinds of troubles and also doesn't make sense.
// So, just changing individual fields
l.conf.VisorPK = conf.VisorPK
l.conf.Apps = conf.Apps
l.conf.ServerAddr = conf.ServerAddr
}

// AutoStart auto-starts marked apps.
Expand Down Expand Up @@ -251,7 +257,8 @@ func (l *Launcher) RestartApp(name string) error {
}

cmd := proc.Cmd()
if err := l.StartApp(name, cmd.Args, cmd.Env); err != nil {
// complete list of args includes binary name which is not needed, so omit it
if err := l.StartApp(name, cmd.Args[1:], cmd.Env); err != nil {
return fmt.Errorf("failed to start %s: %w", name, err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/visor/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (rc *rpcClient) SetAppPassword(appName, password string) error {

// SetAppPK calls SetAppPK.
func (rc *rpcClient) SetAppPK(appName string, pk cipher.PubKey) error {
return rc.Call("SetSocksClientPK", &SetAppPKIn{
return rc.Call("SetAppPK", &SetAppPKIn{
AppName: appName,
PK: pk,
}, &struct{}{})
Expand Down
5 changes: 1 addition & 4 deletions pkg/visor/visorconfig/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ func (v1 *V1) UpdateAppAutostart(launch *launcher.Launcher, appName string, auto
VisorPK: v1.PK,
Apps: conf.Apps,
ServerAddr: conf.ServerAddr,
BinPath: conf.BinPath,
LocalPath: conf.LocalPath,
})
return v1.flush(v1)
}
Expand Down Expand Up @@ -161,8 +159,7 @@ func (v1 *V1) UpdateAppArg(launch *launcher.Launcher, appName, argName, value st
VisorPK: v1.PK,
Apps: conf.Apps,
ServerAddr: conf.ServerAddr,
BinPath: conf.BinPath,
LocalPath: conf.LocalPath,
})

return v1.flush(v1)
}

0 comments on commit c7ae857

Please sign in to comment.