Skip to content

Commit

Permalink
Remove project path from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi committed Jun 6, 2018
1 parent 7c7e792 commit 2bd4868
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
15 changes: 7 additions & 8 deletions client/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import (

// RemoteVPS contains parameters for the VPS
type RemoteVPS struct {
Name string `toml:"name"`
IP string `toml:"IP"`
User string `toml:"user"`
PEM string `toml:"pemfile"`
Branch string `toml:"branch"`
SSHPort string `toml:"ssh_port"`
ProjectDirectory string `toml:"project_directory"`
Daemon *DaemonConfig `toml:"daemon"`
Name string `toml:"name"`
IP string `toml:"IP"`
User string `toml:"user"`
PEM string `toml:"pemfile"`
Branch string `toml:"branch"`
SSHPort string `toml:"ssh_port"`
Daemon *DaemonConfig `toml:"daemon"`
}

// DaemonConfig contains parameters for the Daemon
Expand Down
3 changes: 3 additions & 0 deletions common/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const (

// Stream is a constant used in HTTP GET query strings
Stream = "stream"

// DaemonProjectPath is the path the daemon uses for the deployed project
DaemonProjectPath = "/app/host/project"
)

// DaemonRequest is the configurable body of a request to the daemon.
Expand Down
8 changes: 2 additions & 6 deletions deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,6 @@ deployment. Provide a relative path to your file.`,
log.Fatal(err)
}

if deployment.ProjectDirectory == "" {
log.Fatal(errors.New("no project directory set - add 'project_dir' to your remote configuration"))
}

// Get permissions to copy file with
permissions, err := cmd.Flags().GetString("permissions")
if err != nil {
Expand All @@ -359,7 +355,7 @@ deployment. Provide a relative path to your file.`,
}

// Destination path
remotePath := path.Join(deployment.ProjectDirectory, args[0])
remotePath := path.Join(common.DaemonProjectPath, args[0])

// Initiate copy
session := client.NewSSHRunner(deployment.RemoteVPS)
Expand All @@ -368,7 +364,7 @@ deployment. Provide a relative path to your file.`,
log.Fatal(err.Error())
}

fmt.Println("File", args[0], "has been copied to", deployment.ProjectDirectory, "on remote", remoteName)
fmt.Println("File", args[0], "has been copied to", common.DaemonProjectPath, "on remote", remoteName)
},
}

Expand Down
2 changes: 0 additions & 2 deletions input.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ func addRemoteWalkthrough(
PEM: pemLoc,
Branch: branch,
SSHPort: sshPort,
// ProjectDirectory is temporary - allow user configuration later
ProjectDirectory: "$HOME/project",
Daemon: &client.DaemonConfig{
Port: port,
Secret: secret,
Expand Down

0 comments on commit 2bd4868

Please sign in to comment.