| 39 | ) |
| 40 | |
| 41 | func setupConfig(c *cli.Context) *util.Config { |
| 42 | l.SetUpBasicLogging(logWriter, l.DefaultFormat) |
| 43 | |
| 44 | var config *util.Config |
| 45 | configFilePath := c.String("config-file") |
| 46 | |
| 47 | if configFilePath != "" && !c.Bool("verbose") { |
| 48 | config = util.GetConfig() |
| 49 | err := config.ReadConfig(configFilePath) |
| 50 | if err != nil { |
| 51 | log.Error(fmt.Sprintf("Failed to read config from path %s: %v", configFilePath, err)) |
| 52 | os.Exit(1) |
| 53 | } |
| 54 | |
| 55 | err = l.SetUpLogging(config) |
| 56 | if err != nil { |
| 57 | log.Error(fmt.Sprintf("Failed to set up logging: %v", err)) |
| 58 | os.Exit(1) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | return config |
| 63 | } |
| 64 | |
| 65 | // TestExtensions runs extension tests when invoked from Gohan CLI |
| 66 | func TestExtensions(context *cli.Context) { |