mirror of
https://codeberg.org/icewind/rss-webhook-trigger.git
synced 2026-06-03 18:04:09 +02:00
support systemd credentials
This commit is contained in:
parent
b322a2afaf
commit
8fc69baf69
3 changed files with 313 additions and 307 deletions
|
|
@ -6,6 +6,7 @@ use std::collections::HashMap;
|
|||
use std::convert::{TryFrom, TryInto};
|
||||
use std::path::Path;
|
||||
use reqwest::header::{HeaderValue, InvalidHeaderValue};
|
||||
use secretfile::{load, SecretError};
|
||||
use serde::de::Error;
|
||||
use serde_json::Value;
|
||||
|
||||
|
|
@ -56,11 +57,10 @@ impl TryFrom<&HeaderVal> for HeaderValue {
|
|||
}
|
||||
}
|
||||
|
||||
fn load_secret(raw: String) -> Result<String, std::io::Error> {
|
||||
fn load_secret(raw: String) -> Result<String, SecretError> {
|
||||
let path: &Path = raw.as_ref();
|
||||
if raw.starts_with('/') && path.exists() {
|
||||
let raw = read_to_string(raw)?;
|
||||
Ok(raw.trim().into())
|
||||
if (raw.starts_with('/') && path.exists()) || raw.contains("$CREDENTIALS_DIRECTORY") {
|
||||
load(&raw)
|
||||
} else {
|
||||
Ok(raw)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue