Function spacetimedb_cli::util::get_auth_header

source ·
pub async fn get_auth_header(
    config: &mut Config,
    anon_identity: bool,
    identity_or_name: Option<&str>,
    server: Option<&str>
) -> Result<Option<(String, Identity)>>
Expand description

Gets the auth_header for a request to the server depending on how you want to identify yourself. If you specify anon_identity = true then no auth_header is returned. If you specify an identity this function will try to find the identity in the config file. If no identity can be found, the program will exit(1). If you do not specify an identity this function will either get the default identity if one exists or create and save a new default identity returning the one that was just created.

§Arguments

  • config - The config file reference
  • anon_identity - Whether or not to just use an anonymous identity (no identity)
  • identity_or_name - The identity to try to lookup, which is typically provided from the command line