@@ -43,22 +43,20 @@ var (
43
43
// loadConfigFile loads a default config file if --chain is specified, a specific
44
44
// config if --config is specified, or the default gossamer config otherwise.
45
45
func loadConfigFile (ctx * cli.Context , cfg * ctoml.Config ) (err error ) {
46
- // check --config flag and load toml configuration from config.toml
47
- if cfgPath := ctx .GlobalString (ConfigFlag .Name ); cfgPath != "" {
48
- logger .Info ("loading toml configuration from " + cfgPath + "..." )
49
- if cfg == nil {
50
- cfg = & ctoml.Config {} // if configuration not set, create empty configuration
51
- } else {
52
- logger .Warn (
53
- "overwriting default configuration with id " + cfg .Global .ID +
54
- " with toml configuration values from " + cfgPath )
55
- }
56
- err = loadConfig (cfg , cfgPath ) // load toml values into configuration
57
- } else {
58
- err = loadConfig (cfg , defaultGssmrConfigPath )
46
+ cfgPath := ctx .GlobalString (ConfigFlag .Name )
47
+ if cfgPath == "" {
48
+ return loadConfig (cfg , defaultGssmrConfigPath )
59
49
}
60
50
61
- return err
51
+ logger .Info ("loading toml configuration from " + cfgPath + "..." )
52
+ if cfg == nil {
53
+ cfg = new (ctoml.Config )
54
+ } else {
55
+ logger .Warn (
56
+ "overwriting default configuration with id " + cfg .Global .ID +
57
+ " with toml configuration values from " + cfgPath )
58
+ }
59
+ return loadConfig (cfg , cfgPath )
62
60
}
63
61
64
62
func setupConfigFromChain (ctx * cli.Context ) (* ctoml.Config , * dot.Config , error ) {
@@ -215,15 +213,14 @@ func createImportStateConfig(ctx *cli.Context) (*dot.Config, error) {
215
213
}
216
214
217
215
func createBuildSpecConfig (ctx * cli.Context ) (* dot.Config , error ) {
218
- var tomlCfg * ctoml.Config
219
- cfg := & dot.Config {}
216
+ tomlCfg := new (ctoml.Config )
220
217
err := loadConfigFile (ctx , tomlCfg )
221
218
if err != nil {
222
219
logger .Errorf ("failed to load toml configuration: %s" , err )
223
220
return nil , err
224
221
}
225
222
226
- // set global configuration values
223
+ cfg := new (dot. Config )
227
224
if err := setDotGlobalConfig (ctx , tomlCfg , & cfg .Global ); err != nil {
228
225
logger .Errorf ("failed to set global node configuration: %s" , err )
229
226
return nil , err
0 commit comments