Struct sentry_rs::models::SentryCredentials [] [src]

pub struct SentryCredentials {
    pub scheme: String,
    pub key: String,
    pub secret: String,
    pub host: Option<String>,
    pub project_id: String,
}

Some Sentry Credentials. Which although not immediatly obvious are super easy to get. Firsrt things first, go fetch your Client Keys (DSN) like you normally would for a project. Should look something like:

https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY@ZZZZ/AAA

The "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" value is your "key". The "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" value is your "secret". The "ZZZZ" value is your "host". The "AAA" value is your "project_id".

Examples

extern crate sentry_rs;
use sentry_rs::models::SentryCredentials;
use std::env;

fn main() {
  let credentials = SentryCredentials {
    scheme: env::var("SENTRY_SCHEME").unwrap_or("https".to_owned()),
    key: env::var("SENTRY_KEY").unwrap_or("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".to_owned()),
    secret: env::var("SENTRY_SECRET").unwrap_or("YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY".to_owned()),
    host: Some(env::var("SENTRY_HOST").unwrap_or("sentry.io".to_owned())),
    project_id: env::var("SENTRY_PROJECT_ID").unwrap_or("XX".to_owned()),
  };
}

You can also parse sentry credentials from a String:

extern crate sentry_rs;
use sentry_rs::models::*;

fn main() {
  let sentry_creds: SentryCredentials =
    "https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY@ZZZZ/AAA"
    .to_owned()
    .parse::<SentryCredentials>().unwrap();
}

Fields

Trait Implementations

impl Clone for SentryCredentials
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for SentryCredentials
[src]

[src]

Formats the value using the given formatter.

impl Eq for SentryCredentials
[src]

impl PartialEq for SentryCredentials
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl FromStr for SentryCredentials
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more