Skip to content

Commit

Permalink
Rename app config's SockFile => SockFilePath to make it more clea…
Browse files Browse the repository at this point in the history
…r. Path now is being passed correcrtly from visor
  • Loading branch information
Darkren committed Nov 21, 2019
1 parent 842ea26 commit 222fd74
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
12 changes: 6 additions & 6 deletions pkg/app/appcommon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package appcommon

// Config defines configuration parameters for `Proc`.
type Config struct {
Name string `json:"name"`
Version string `json:"version"`
SockFile string `json:"sock_file"`
VisorPK string `json:"visor_pk"`
BinaryDir string `json:"binary_dir"`
WorkDir string `json:"work_dir"`
Name string `json:"name"`
Version string `json:"version"`
SockFilePath string `json:"sock_file_path"`
VisorPK string `json:"visor_pk"`
BinaryDir string `json:"binary_dir"`
WorkDir string `json:"work_dir"`
}
6 changes: 3 additions & 3 deletions pkg/app/appserver/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewProc(log *logging.Logger, c appcommon.Config, args []string, stdout, std

env := make([]string, 0, 3)
env = append(env, fmt.Sprintf(appKeyEnvFormat, key))
env = append(env, fmt.Sprintf(sockFileEnvFormat, c.SockFile))
env = append(env, fmt.Sprintf(sockFileEnvFormat, c.SockFilePath))
env = append(env, fmt.Sprintf(visorPKEnvFormat, c.VisorPK))

cmd := exec.Command(binaryPath, args...) // nolint:gosec
Expand All @@ -48,7 +48,7 @@ func NewProc(log *logging.Logger, c appcommon.Config, args []string, stdout, std
cmd.Stderr = stderr

rpcS, err := New(logging.MustGetLogger(fmt.Sprintf("app_rpc_server_%s", key)),
c.SockFile, key)
c.SockFilePath, key)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func (p *Proc) Run() error {
return nil
}

// Stop stops the applicacation. It stops the process and
// Stop stops the application. It stops the process and
// shuts down the RPC server.
func (p *Proc) Stop() error {
p.closeRPCServer()
Expand Down
10 changes: 5 additions & 5 deletions pkg/visor/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ func TestStartStopApp(t *testing.T) {

pm := &appserver.MockProcManager{}
appCfg1 := appcommon.Config{
Name: app,
Version: apps[0].Version,
SockFile: nodeCfg.AppServerSockFile,
VisorPK: nodeCfg.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", app, fmt.Sprintf("v%s", apps[0].Version)),
Name: app,
Version: apps[0].Version,
SockFilePath: nodeCfg.AppServerSockFile,
VisorPK: nodeCfg.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", app, fmt.Sprintf("v%s", apps[0].Version)),
}
appArgs1 := append([]string{filepath.Join(node.dir(), app)}, apps[0].Args...)
appPID1 := appcommon.ProcID(10)
Expand Down
12 changes: 6 additions & 6 deletions pkg/visor/visor.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,12 @@ func (node *Node) SpawnApp(config *AppConfig, startCh chan<- struct{}) (err erro
}

appCfg := appcommon.Config{
Name: config.App,
Version: config.Version,
SockFile: node.conf.AppServerSockFile,
VisorPK: node.conf.Node.StaticPubKey.Hex(),
BinaryDir: node.appsPath,
WorkDir: filepath.Join(node.localPath, config.App, fmt.Sprintf("v%s", config.Version)),
Name: config.App,
Version: config.Version,
SockFilePath: filepath.Join(node.dir(), node.conf.AppServerSockFile),
VisorPK: node.conf.Node.StaticPubKey.Hex(),
BinaryDir: node.appsPath,
WorkDir: filepath.Join(node.localPath, config.App, fmt.Sprintf("v%s", config.Version)),
}

if _, err := ensureDir(appCfg.WorkDir); err != nil {
Expand Down
40 changes: 20 additions & 20 deletions pkg/visor/visor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ func TestNodeStartClose(t *testing.T) {

pm := &appserver.MockProcManager{}
appCfg1 := appcommon.Config{
Name: apps[0].App,
Version: apps[0].Version,
SockFile: nodeCfg.AppServerSockFile,
VisorPK: nodeCfg.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", apps[0].App, fmt.Sprintf("v%s", apps[0].Version)),
Name: apps[0].App,
Version: apps[0].Version,
SockFilePath: nodeCfg.AppServerSockFile,
VisorPK: nodeCfg.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", apps[0].App, fmt.Sprintf("v%s", apps[0].Version)),
}
appArgs1 := append([]string{filepath.Join(node.dir(), apps[0].App)}, apps[0].Args...)
appPID1 := appcommon.ProcID(10)
Expand Down Expand Up @@ -196,11 +196,11 @@ func TestNodeSpawnApp(t *testing.T) {

pm := &appserver.MockProcManager{}
appCfg := appcommon.Config{
Name: app.App,
Version: app.Version,
SockFile: nodeCfg.AppServerSockFile,
VisorPK: nodeCfg.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", app.App, fmt.Sprintf("v%s", app.Version)),
Name: app.App,
Version: app.Version,
SockFilePath: nodeCfg.AppServerSockFile,
VisorPK: nodeCfg.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", app.App, fmt.Sprintf("v%s", app.Version)),
}
appArgs := append([]string{filepath.Join(node.dir(), app.App)}, app.Args...)
pm.On("Wait", app.App).Return(testhelpers.NoErr)
Expand Down Expand Up @@ -254,11 +254,11 @@ func TestNodeSpawnAppValidations(t *testing.T) {

pm := &appserver.MockProcManager{}
appCfg := appcommon.Config{
Name: app.App,
Version: app.Version,
SockFile: c.AppServerSockFile,
VisorPK: c.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", app.App, fmt.Sprintf("v%s", app.Version)),
Name: app.App,
Version: app.Version,
SockFilePath: c.AppServerSockFile,
VisorPK: c.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", app.App, fmt.Sprintf("v%s", app.Version)),
}
appArgs := append([]string{filepath.Join(node.dir(), app.App)}, app.Args...)

Expand Down Expand Up @@ -290,11 +290,11 @@ func TestNodeSpawnAppValidations(t *testing.T) {

pm := &appserver.MockProcManager{}
appCfg := appcommon.Config{
Name: app.App,
Version: app.Version,
SockFile: c.AppServerSockFile,
VisorPK: c.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", app.App, fmt.Sprintf("v%s", app.Version)),
Name: app.App,
Version: app.Version,
SockFilePath: c.AppServerSockFile,
VisorPK: c.Node.StaticPubKey.Hex(),
WorkDir: filepath.Join("", app.App, fmt.Sprintf("v%s", app.Version)),
}
appArgs := append([]string{filepath.Join(node.dir(), app.App)}, app.Args...)

Expand Down

0 comments on commit 222fd74

Please sign in to comment.