// config overrides defaults with config file and flag values. func config() { if cfgData, err := bort.LoadConfig(cfgFile); err != nil { log.Println(err) } else if err := json.Unmarshal(cfgData, &cfg); err != nil { log.Println(err) } flag.Visit(func(f *flag.Flag) { switch f.Name { case "a": cfg.Address = flags.Address case "o": cfg.OutboxSize = flags.OutboxSize } }) }
// config overrides defaults with config file and flag values. func config() { if cfgData, err := bort.LoadConfig(cfgFile); err != nil { log.Println(err) } else if err := json.Unmarshal(cfgData, &cfg); err != nil { log.Println(err) } flag.Visit(func(f *flag.Flag) { switch f.Name { case "n": cfg.Nick = flags.Nick case "s": cfg.Server = flags.Server case "c": cfg.Channel = flags.Channel case "a": cfg.Address = flags.Address case "p": cfg.CmdPrefix = flags.CmdPrefix case "t": cfg.PollPeriod = flags.PollPeriod } }) }