added an env variable

Added an environment variable for the home directory so we don't
have to hardcode it or enter it inside a config file
This commit is contained in:
Wyatt J. Miller 2019-09-26 00:24:15 -04:00
parent e766f580bb
commit 5afa2c0f9a
2 changed files with 5 additions and 2 deletions

4
ssh.go
View File

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"os"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
) )
@ -91,12 +92,13 @@ func (s SSHConnection) openSession(client SSHClients) SSHSessions {
func (s SSHConnection) executeSFTP(execute SSHClients) SSHSFTP { func (s SSHConnection) executeSFTP(execute SSHClients) SSHSFTP {
// execute order 66 lol // execute order 66 lol
sftp := SSHSFTP{} sftp := SSHSFTP{}
homedir := os.Getenv("HOME")
for _, j := range execute { for _, j := range execute {
// TODO: this is just a placeholder, change to the actual tarring executable // TODO: this is just a placeholder, change to the actual tarring executable
getFile(j) getFile(j)
err := gzipit("/home/wyatt/"+filename, ".") err := gzipit(homedir+filename, ".")
if err != nil { if err != nil {
fmt.Errorf("Cannot gzip file(s)", err) fmt.Errorf("Cannot gzip file(s)", err)

View File

@ -4,3 +4,4 @@
- Allow fetching of multiple log files (fields under the defined host? Seperate key/field? Dynamic?) - Allow fetching of multiple log files (fields under the defined host? Seperate key/field? Dynamic?)
- Allow different machines to collect different log files - Allow different machines to collect different log files
- Allow to gather directories of log files - Allow to gather directories of log files
- Develop a log getting logs for sanity