8000 refactor: store configuration filename in the struct · symfony-cli/symfony-cli@a045593 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit a045593

Browse files
committed
refactor: store configuration filename in the struct
1 parent 5f17f1d commit a045593

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

local/project/config.go

Lines 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:&q CF52 uot;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