diff --git a/cmd/mutagen/project/flush.go b/cmd/mutagen/project/flush.go index b4ac8e00..606a1a1b 100644 --- a/cmd/mutagen/project/flush.go +++ b/cmd/mutagen/project/flush.go @@ -28,7 +28,7 @@ func flushMain(command *cobra.Command, arguments []string) error { // relative paths (including relative synchronization paths and relative // Unix Domain Socket paths) to be resolved relative to the project // configuration file. - configurationFileName := project.DefaultConfigurationFileName + configurationFileName := project.ConfigurationFileName() if flushConfiguration.projectFile != "" { var directory string directory, configurationFileName = filepath.Split(flushConfiguration.projectFile) diff --git a/cmd/mutagen/project/list.go b/cmd/mutagen/project/list.go index 2df690bb..bdfef5f1 100644 --- a/cmd/mutagen/project/list.go +++ b/cmd/mutagen/project/list.go @@ -29,7 +29,7 @@ func listMain(command *cobra.Command, arguments []string) error { // relative paths (including relative synchronization paths and relative // Unix Domain Socket paths) to be resolved relative to the project // configuration file. - configurationFileName := project.DefaultConfigurationFileName + configurationFileName := project.ConfigurationFileName() if listConfiguration.projectFile != "" { var directory string directory, configurationFileName = filepath.Split(listConfiguration.projectFile) diff --git a/cmd/mutagen/project/pause.go b/cmd/mutagen/project/pause.go index 291f6f7a..ff3493c2 100644 --- a/cmd/mutagen/project/pause.go +++ b/cmd/mutagen/project/pause.go @@ -30,7 +30,7 @@ func pauseMain(command *cobra.Command, arguments []string) error { // relative paths (including relative synchronization paths and relative // Unix Domain Socket paths) to be resolved relative to the project // configuration file. - configurationFileName := project.DefaultConfigurationFileName + configurationFileName := project.ConfigurationFileName() if pauseConfiguration.projectFile != "" { var directory string directory, configurationFileName = filepath.Split(pauseConfiguration.projectFile) diff --git a/cmd/mutagen/project/reset.go b/cmd/mutagen/project/reset.go index e9115223..5b2fc3d9 100644 --- a/cmd/mutagen/project/reset.go +++ b/cmd/mutagen/project/reset.go @@ -28,7 +28,7 @@ func resetMain(command *cobra.Command, arguments []string) error { // relative paths (including relative synchronization paths and relative // Unix Domain Socket paths) to be resolved relative to the project // configuration file. - configurationFileName := project.DefaultConfigurationFileName + configurationFileName := project.ConfigurationFileName() if resetConfiguration.projectFile != "" { var directory string directory, configurationFileName = filepath.Split(resetConfiguration.projectFile) diff --git a/cmd/mutagen/project/resume.go b/cmd/mutagen/project/resume.go index 8903c782..c5e4b324 100644 --- a/cmd/mutagen/project/resume.go +++ b/cmd/mutagen/project/resume.go @@ -30,7 +30,7 @@ func resumeMain(command *cobra.Command, arguments []string) error { // relative paths (including relative synchronization paths and relative // Unix Domain Socket paths) to be resolved relative to the project // configuration file. - configurationFileName := project.DefaultConfigurationFileName + configurationFileName := project.ConfigurationFileName(); if resumeConfiguration.projectFile != "" { var directory string directory, configurationFileName = filepath.Split(resumeConfiguration.projectFile) diff --git a/cmd/mutagen/project/run.go b/cmd/mutagen/project/run.go index a8206d47..8618b6cc 100644 --- a/cmd/mutagen/project/run.go +++ b/cmd/mutagen/project/run.go @@ -33,7 +33,7 @@ func runMain(_ *cobra.Command, arguments []string) error { // relative paths (including relative synchronization paths and relative // Unix Domain Socket paths) to be resolved relative to the project // configuration file. - configurationFileName := project.DefaultConfigurationFileName + configurationFileName := project.ConfigurationFileName() if runConfiguration.projectFile != "" { var directory string directory, configurationFileName = filepath.Split(runConfiguration.projectFile) diff --git a/cmd/mutagen/project/start.go b/cmd/mutagen/project/start.go index 3f8b657a..ecd370a2 100644 --- a/cmd/mutagen/project/start.go +++ b/cmd/mutagen/project/start.go @@ -39,7 +39,7 @@ func startMain(command *cobra.Command, arguments []string) error { // relative paths (including relative synchronization paths and relative // Unix Domain Socket paths) to be resolved relative to the project // configuration file. - configurationFileName := project.DefaultConfigurationFileName + configurationFileName := project.ConfigurationFileName() if startConfiguration.projectFile != "" { var directory string directory, configurationFileName = filepath.Split(startConfiguration.projectFile) diff --git a/cmd/mutagen/project/terminate.go b/cmd/mutagen/project/terminate.go index d099a1b6..7e3abb35 100644 --- a/cmd/mutagen/project/terminate.go +++ b/cmd/mutagen/project/terminate.go @@ -30,7 +30,7 @@ func terminateMain(command *cobra.Command, arguments []string) error { // relative paths (including relative synchronization paths and relative // Unix Domain Socket paths) to be resolved relative to the project // configuration file. - configurationFileName := project.DefaultConfigurationFileName + configurationFileName := project.ConfigurationFileName() if terminateConfiguration.projectFile != "" { var directory string directory, configurationFileName = filepath.Split(terminateConfiguration.projectFile) diff --git a/pkg/project/paths.go b/pkg/project/paths.go index 35672084..bde143f2 100644 --- a/pkg/project/paths.go +++ b/pkg/project/paths.go @@ -1,5 +1,7 @@ package project +import "os" + const ( // DefaultConfigurationFileName is the name of the Mutagen project // configuration file. @@ -8,3 +10,11 @@ const ( // order to compute the corresponding lock file. LockFileExtension = ".lock" ) + +func ConfigurationFileName() string { + fileName := os.Getenv("MUTAGEN_PROJECT_FILE") + if fileName == "" { + return DefaultConfigurationFileName + } + return fileName +}