Skip to content

Commit

Permalink
Fix improper default value check in tbot's FromCLIConf() (#11169)
Browse files Browse the repository at this point in the history
The default `join_method` value was improperly assumed to be "" which
caused any onboarding config from the config file to be overwritten.

This uses the correct default and allows bots to be fully onboarded
via config file.

Fixes #11099
  • Loading branch information
timothyb89 authored Mar 16, 2022
1 parent 3f507df commit dba79e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tool/tbot/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func FromCLIConf(cf *CLIConf) (*BotConfig, error) {
// (CAPath, CAPins, etc follow different codepaths so we don't want a
// situation where different fields become set weirdly due to struct
// merging)
if cf.Token != "" || len(cf.CAPins) > 0 || cf.JoinMethod != "" {
if cf.Token != "" || len(cf.CAPins) > 0 || cf.JoinMethod != DefaultJoinMethod {
onboarding := config.Onboarding
if onboarding != nil && (onboarding.Token != "" || onboarding.CAPath != "" || len(onboarding.CAPins) > 0) || cf.JoinMethod != DefaultJoinMethod {
// To be safe, warn about possible confusion.
Expand Down

0 comments on commit dba79e8

Please sign in to comment.