MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / get_auth_header

Function get_auth_header

crates/cli/src/util.rs:174–186  ·  view source on GitHub ↗

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 ide

(
    config: &mut Config,
    anon_identity: bool,
    target_server: Option<&str>,
    interactive: bool,
)

Source from the content-addressed store, hash-verified

172/// * `anon_identity` - Whether or not to just use an anonymous identity (no identity)
173/// * `identity_or_name` - The identity to try to lookup, which is typically provided from the command line
174pub async fn get_auth_header(
175 config: &mut Config,
176 anon_identity: bool,
177 target_server: Option<&str>,
178 interactive: bool,
179) -> anyhow::Result<AuthHeader> {
180 let token = if anon_identity {
181 None
182 } else {
183 Some(get_login_token_or_log_in(config, target_server, interactive).await?)
184 };
185 Ok(AuthHeader { token })
186}
187
188#[derive(Debug, Clone)]
189pub struct AuthHeader {

Callers 11

execFunction · 0.85
execFunction · 0.85
parse_reqFunction · 0.85
execFunction · 0.85
execute_publish_configsFunction · 0.85
execFunction · 0.85
execFunction · 0.85
execFunction · 0.85
execFunction · 0.85
execFunction · 0.85
start_log_streamFunction · 0.85

Calls 2

OkFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…