// ParseConfig parses the config at path. // Returns a demo configuration if path is blank. func (cmd *Command) ParseConfig(path string) (*server.Config, error) { // Use demo configuration if no config path is specified. if path == "" { log.Println("No configuration provided, using default settings") return server.NewDemoConfig() } log.Println("Using configuration at:", path) config := server.NewConfig() if _, err := toml.DecodeFile(path, &config); err != nil { return nil, err } return config, nil }
// ParseConfig parses the config at path. // Returns a demo configuration if path is blank. func (cmd *PrintConfigCommand) parseConfig(path string) (*server.Config, error) { config, err := server.NewDemoConfig() if err != nil { config = server.NewConfig() } if path == "" { return config, nil } log.Println("Merging with configuration at:", path) if _, err := toml.DecodeFile(path, &config); err != nil { return nil, err } return config, nil }