Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 046851b

Browse filesBrowse files
committed
refactor: store configuration filename in the struct
1 parent 07bba9d commit 046851b
Copy full SHA for 046851b

File tree

Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed

‎local/project/config.go

Copy file name to clipboardExpand all lines: local/project/config.go
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ type FileConfig struct {
5858
} `yaml:"proxy"`
5959
HTTP *Config `yaml:"http"`
6060
Workers map[string]*Worker `yaml:"workers"`
61+
62+
filename string
6163
}
6264

6365
type Worker struct {
@@ -141,7 +143,9 @@ func newConfigFromFile(configFile string) (*FileConfig, error) {
141143
return nil, err
142144
}
143145

144-
var fileConfig FileConfig
146+
fileConfig := FileConfig{
147+
filename: filepath.Base(configFile),
148+
}
145149
if err := yaml.Unmarshal(contents, &fileConfig); err != nil {
146150
return nil, err
147151
}
@@ -184,7 +188,7 @@ func (c *FileConfig) parseWorkers() error {
184188

185189
for k, v := range c.Workers {
186190
if v == nil {
187-
return errors.Errorf("The \"%s\" worker entry in \".symfony.local.yaml\" cannot be empty.", k)
191+
return errors.Errorf(`The "%s" worker entry in ".%s" cannot be empty.`, k, c.filename)
188192
}
189193
}
190194

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.