This commit is contained in:
2024-08-04 01:42:51 +02:00
parent ae7eb7a159
commit e4ca97b99e
2 changed files with 7 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ func CopyToRemote(fileName, remotePath string) error {
err := utils.CheckEnvVars(sshHVars) err := utils.CheckEnvVars(sshHVars)
if err != nil { if err != nil {
utils.Error("Error checking environment variables\n: %s", err) utils.Error("Error checking environment variables: %s", err)
os.Exit(1) os.Exit(1)
} }
@@ -31,9 +31,9 @@ func CopyToRemote(fileName, remotePath string) error {
} else { } else {
if sshPassword == "" { if sshPassword == "" {
return errors.New("SSH_PASSWORD environment variable is required if SSH_IDENTIFY_FILE is empty\n") return errors.New("SSH_PASSWORD environment variable is required if SSH_IDENTIFY_FILE is empty")
} }
utils.Warn("Accessing the remote server using password, password is not recommended\n") utils.Warn("Accessing the remote server using password, password is not recommended")
clientConfig, _ = auth.PasswordKey(sshUser, sshPassword, ssh.InsecureIgnoreHostKey()) clientConfig, _ = auth.PasswordKey(sshUser, sshPassword, ssh.InsecureIgnoreHostKey())
} }
@@ -43,7 +43,7 @@ func CopyToRemote(fileName, remotePath string) error {
// Connect to the remote server // Connect to the remote server
err = client.Connect() err = client.Connect()
if err != nil { if err != nil {
return errors.New("Couldn't establish a connection to the remote server\n") return errors.New("Couldn't establish a connection to the remote server")
} }
// Open a file // Open a file
@@ -83,7 +83,7 @@ func CopyFromRemote(fileName, remotePath string) error {
if sshPassword == "" { if sshPassword == "" {
return errors.New("SSH_PASSWORD environment variable is required if SSH_IDENTIFY_FILE is empty\n") return errors.New("SSH_PASSWORD environment variable is required if SSH_IDENTIFY_FILE is empty\n")
} }
utils.Warn("Accessing the remote server using password, password is not recommended\n") utils.Warn("Accessing the remote server using password, password is not recommended")
clientConfig, _ = auth.PasswordKey(sshUser, sshPassword, ssh.InsecureIgnoreHostKey()) clientConfig, _ = auth.PasswordKey(sshUser, sshPassword, ssh.InsecureIgnoreHostKey())
} }

View File

@@ -111,7 +111,7 @@ func TestDatabaseConnection() {
cmd.Stderr = &out cmd.Stderr = &out
err := cmd.Run() err := cmd.Run()
if err != nil { if err != nil {
Error(fmt.Sprintf("Error testing database connection: %v\nOutput: %s\n", err, out.String())) Error("Error testing database connection: %v\nOutput: %s", err, out.String())
os.Exit(1) os.Exit(1)
} }
@@ -157,7 +157,7 @@ func GetEnvVariable(envName, oldEnvName string) string {
if err != nil { if err != nil {
return value return value
} }
Warn("%s is deprecated, please use %s instead!\n", oldEnvName, envName) Warn("%s is deprecated, please use %s instead!", oldEnvName, envName)
} }
} }