blob: 63ae02ce753012fda60476094f495cea2b45af45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use forgejo_api::Forgejo;
pub fn login() -> Forgejo {
let url = url::Url::parse(&std::env::var("FORGEJO_API_CI_INSTANCE_URL").unwrap()).unwrap();
let token = std::env::var("FORGEJO_API_CI_TOKEN").unwrap();
Forgejo::new(forgejo_api::Auth::Token(&token), url).unwrap()
}
pub fn login_pass(username: &str, password: &str) -> Forgejo {
let url = url::Url::parse(&std::env::var("FORGEJO_API_CI_INSTANCE_URL").unwrap()).unwrap();
let auth = forgejo_api::Auth::Password {
username,
password,
mfa: None,
};
Forgejo::new(auth, url).unwrap()
}
|