Skip to content

Commit

Permalink
propagate login timeout to workspace command
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Oct 18, 2023
1 parent dbd01a5 commit 138aff6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions cmd/slackdump/internal/cfg/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ var (
ConfigFile string
Workspace string

SlackToken string
SlackCookie string
Browser browser.Browser
Limits = slackdump.DefLimits
SlackToken string
SlackCookie string
Browser browser.Browser
LoginTimeout time.Duration = browser.DefLoginTimeout
Limits = slackdump.DefLimits

DumpFiles bool
NoChunkCache bool
Expand Down Expand Up @@ -87,6 +88,7 @@ func SetBaseFlags(fs *flag.FlagSet, mask FlagMask) {
// COOKIE environment variable is deprecated and will be removed in v2.5.0, use SLACK_COOKIE instead.
fs.StringVar(&SlackCookie, "cookie", osenv.Secret("SLACK_COOKIE", osenv.Secret("COOKIE", "")), "d= cookie `value` or a path to a cookie.txt file\n(environment: SLACK_COOKIE)")
fs.Var(&Browser, "browser", "browser to use for EZ-Login 3000 (default: firefox)")
fs.DurationVar(&LoginTimeout, "browser-timeout", LoginTimeout, "Browser login `timeout`")
}
if mask&OmitDownloadFlag == 0 {
fs.BoolVar(&DumpFiles, "files", true, "enables file attachments (to disable, specify: -files=false)")
Expand Down
2 changes: 1 addition & 1 deletion cmd/slackdump/internal/workspace/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func init() {
// runWspNew authenticates in the new workspace.
func runWspNew(ctx context.Context, cmd *base.Command, args []string) error {
lg := logger.FromContext(ctx)
m, err := cache.NewManager(cfg.CacheDir(), cache.WithAuthOpts(auth.BrowserWithBrowser(cfg.Browser)))
m, err := cache.NewManager(cfg.CacheDir(), cache.WithAuthOpts(auth.BrowserWithBrowser(cfg.Browser), auth.BrowserWithTimeout(cfg.LoginTimeout)))
if err != nil {
base.SetExitStatus(base.SCacheError)
return fmt.Errorf("error initialising workspace manager: %s", err)
Expand Down

0 comments on commit 138aff6

Please sign in to comment.