mirror of
https://codeberg.org/icewind/rss-webhook-trigger.git
synced 2026-11-30 20:20:51 +01:00
clippy, interal nix option
This commit is contained in:
parent
c04a04ea29
commit
7821076b15
3 changed files with 21 additions and 15 deletions
|
|
@ -8,13 +8,19 @@ with lib; let
|
|||
cfg = config.services.rss-webhook-trigger;
|
||||
format = pkgs.formats.toml {};
|
||||
configFile = format.generate "trigger.toml" {
|
||||
inherit (cfg) jwt interval;
|
||||
feed = cfg.hooks;
|
||||
jwt = cfg.jwt;
|
||||
};
|
||||
in {
|
||||
options.services.rss-webhook-trigger = {
|
||||
enable = mkEnableOption "Enables the rss-webhook-trigger service";
|
||||
|
||||
interval = mkOption {
|
||||
type = types.int;
|
||||
default = 1800;
|
||||
description = "how often to check the feeds for updates";
|
||||
};
|
||||
|
||||
jwt = mkOption {
|
||||
description = "Configuration for generating JWT authorization tokens";
|
||||
type = types.nullOr (types.submodule {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::error::{ConfigError, JwtError};
|
||||
use jsonwebtoken::EncodingKey;
|
||||
use secretfile::{load, SecretError};
|
||||
use secretfile::{SecretError, load};
|
||||
use serde::de::Error;
|
||||
use serde::{Deserialize, Deserializer};
|
||||
use serde_json::Value;
|
||||
|
|
@ -66,7 +66,7 @@ impl TryFrom<JwtConfigRaw> for JwtConfig {
|
|||
let secret = load_secret(value.key)?;
|
||||
|
||||
Ok(JwtConfig {
|
||||
key: EncodingKey::from_rsa_pem(&secret.as_bytes())?,
|
||||
key: EncodingKey::from_rsa_pem(secret.as_bytes())?,
|
||||
issuer: value.issuer,
|
||||
listen: value.listen,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ fn main() -> MainResult {
|
|||
|
||||
let config = Config::from_file(&file)?;
|
||||
|
||||
if let Some(jwt_config) = config.jwt.clone() {
|
||||
if let Some(listen) = jwt_config.listen.clone() {
|
||||
if let Some(jwt_config) = config.jwt.clone()
|
||||
&& let Some(listen) = jwt_config.listen.clone()
|
||||
{
|
||||
spawn(|| {
|
||||
let rt = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_io()
|
||||
|
|
@ -59,7 +60,6 @@ fn main() -> MainResult {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
info!("Running rss trigger for {} feeds", config.feed.len());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue