MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / askForJwtToken

Function askForJwtToken

cmd/wsh/cmd/wshcmd-connserver.go:419–437  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

417}
418
419func askForJwtToken() (string, error) {
420 // if it already exists in the environment, great, use it
421 jwtToken := os.Getenv(wavebase.WaveJwtTokenVarName)
422 if jwtToken != "" {
423 fmt.Printf("HAVE-JWT\n")
424 return jwtToken, nil
425 }
426
427 // otherwise, ask for it
428 fmt.Printf("%s\n", wavebase.NeedJwtConst)
429
430 // read a single line from stdin
431 var line string
432 _, err := fmt.Fscanln(os.Stdin, &line)
433 if err != nil {
434 return "", fmt.Errorf("failed to read JWT token from stdin: %w", err)
435 }
436 return strings.TrimSpace(line), nil
437}
438
439func serverRun(cmd *cobra.Command, args []string) error {
440 connServerInitialEnv = envutil.PruneInitialEnv(envutil.SliceToMap(os.Environ()))

Callers 1

serverRunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected