| 263 | } |
| 264 | |
| 265 | func (sc *subcommandContext) run(tunnelID uuid.UUID) error { |
| 266 | credentials, err := sc.findCredentials(tunnelID) |
| 267 | if err != nil { |
| 268 | if e, ok := err.(invalidJSONCredentialError); ok { |
| 269 | sc.log.Error().Msgf("The credentials file at %s contained invalid JSON. This is probably caused by passing the wrong filepath. Reminder: the credentials file is a .json file created via `cloudflared tunnel create`.", e.path) |
| 270 | sc.log.Error().Msgf("Invalid JSON when parsing credentials file: %s", e.err.Error()) |
| 271 | } |
| 272 | return err |
| 273 | } |
| 274 | |
| 275 | return sc.runWithCredentials(credentials) |
| 276 | } |
| 277 | |
| 278 | func (sc *subcommandContext) runWithCredentials(credentials connection.Credentials) error { |
| 279 | sc.log.Info().Str(LogFieldTunnelID, credentials.TunnelID.String()).Msg("Starting tunnel") |