Skip to content

Commit

Permalink
Allow absolute paths to be specified (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
cicalese authored Jul 27, 2023
1 parent dcf8a9d commit 797bdfa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions internal/canasta/canasta.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func CloneStackRepo(orchestrator, canastaId string, path *string) error {
func CopyEnv(envPath, domainName, path, pwd string) error {
if envPath == "" {
envPath = path + "/.env.example"
} else {
} else if !strings.HasPrefix(envPath, "/") {
envPath = pwd + "/" + envPath
}
logging.Print(fmt.Sprintf("Copying %s to %s/.env\n", envPath, path))
Expand All @@ -56,7 +56,9 @@ func CopyEnv(envPath, domainName, path, pwd string) error {
//Copies the LocalSettings.php at localSettingsPath to /config at the installation directory
func CopyLocalSettings(localSettingsPath, path, pwd string) error {
if localSettingsPath != "" {
localSettingsPath = pwd + "/" + localSettingsPath
if !strings.HasPrefix(localSettingsPath, "/") {
localSettingsPath = pwd + "/" + localSettingsPath
}
logging.Print(fmt.Sprintf("Copying %s to %s/config/LocalSettings.php\n", localSettingsPath, path))
err, output := execute.Run("", "cp", localSettingsPath, path+"/config/LocalSettings.php")
if err != nil {
Expand Down
5 changes: 4 additions & 1 deletion internal/orchestrators/orchestrators.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package orchestrators
import (
"fmt"
"os/exec"
"strings"

"github.com/CanastaWiki/Canasta-CLI-Go/internal/config"
"github.com/CanastaWiki/Canasta-CLI-Go/internal/execute"
Expand Down Expand Up @@ -42,7 +43,9 @@ func CopyOverrideFile(path, orchestrator, sourceFilename, pwd string) error {
logging.Print("Copying override file\n")
switch orchestrator {
case "docker-compose":
sourceFilename = pwd + "/" + sourceFilename
if !strings.HasPrefix(sourceFilename, "/") {
sourceFilename = pwd + "/" + sourceFilename
}
var overrideFilename = path + "/docker-compose.override.yml"
logging.Print(fmt.Sprintf("Copying %s to %s\n", sourceFilename, overrideFilename))
err, output := execute.Run("", "cp", sourceFilename, overrideFilename)
Expand Down

0 comments on commit 797bdfa

Please sign in to comment.