Skip to content

Commit 55ebed9

Browse files
harisoraulb
andauthored
Load configs and directories from the working directory (#1952)
* Load configuration and needed directories from the working directory * update check --------- Co-authored-by: Raúl Barroso <[email protected]>
1 parent 977b037 commit 55ebed9

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Diff for: cmd/cli/pipelines_init.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ func (pi *PipelinesInit) Run() error {
186186

187187
fmt.Printf(`Your pipeline has been initialized and created at %s.
188188
189-
To run the pipeline, execute:
190-
191-
conduit --pipelines.path %s`,
192-
pi.configFilePath(), pi.configFilePath())
189+
To run the pipeline, simply run 'conduit'.`, pi.configFilePath())
193190

194191
return nil
195192
}

Diff for: pkg/conduit/config.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ type Config struct {
125125
}
126126

127127
func DefaultConfig() Config {
128-
return DefaultConfigWithBasePath(".")
128+
dir, err := os.Getwd()
129+
if err != nil {
130+
panic(cerrors.Errorf("failed to get current directory: %w", err))
131+
}
132+
133+
return DefaultConfigWithBasePath(dir)
129134
}
130135

131136
func DefaultConfigWithBasePath(basePath string) Config {
@@ -273,7 +278,7 @@ func (c Config) Validate() error {
273278
}
274279
// check if folder exists
275280
_, err = os.Stat(c.Pipelines.Path)
276-
if c.Pipelines.Path != "pipelines" && os.IsNotExist(err) {
281+
if c.Pipelines.Path != DefaultConfig().Pipelines.Path && os.IsNotExist(err) {
277282
return invalidConfigFieldErr("pipelines.path")
278283
}
279284

0 commit comments

Comments
 (0)