15 lines
518 B
Rust
15 lines
518 B
Rust
// SPDX-FileCopyrightText: 2022 Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
use {crate::config::Config, anyhow::Result, reqwest::Url};
|
|
|
|
pub async fn with(configuration: &mut Config, server: &str) -> Result<()> {
|
|
tokio::task::block_in_place(move || -> anyhow::Result<()> {
|
|
configuration
|
|
.credentials
|
|
.add(Url::parse(server)?)
|
|
.expect("Unable to authenticate to NextCloud instance");
|
|
Ok(())
|
|
})
|
|
}
|