pub async fn generate_templates(
		&self,
		secrets: &Secrets,
		path: &str,
		sender: &Sender<Message>,
	) -> Result<()> {
		for (tmpl, conf) in self.iter() {
			// if the secret is among the template declared secrets
			// and all template secrets are defined
			if conf.secrets.get(path).is_some()
				&& secrets
					.iter()
					.filter_map(|(path, val)| {
						if conf.secrets.get(path).is_some() {
							Some(val)
						} else {
							None
						}
					})
					.all(|o| o.is_some())
			{
				// fetch dynamic (exe) secrets before generating the template (dynamic secrets are always invalid)
				for (path, secret) in secrets.iter().filter_map(|(path, val)| {
					if conf.secrets.get(path).is_some() {
						Some((path, val))
					} else {
						None
					}
				}) {
					// fetch the secret without triggering template manifestation once again
					if secret.is_none() || !secret.as_ref().unwrap().is_valid() {
						sender
							.send(Message::GetSecret(path.to_owned(), false))
							.await?;
					}
				}
				// ask the broker to regenerate the template
				sender.send(Message::GenerateTemplate(tmpl.clone())).await?;
			}
		}
		Ok(())
	}
/// (re)generate templates that have a declared secret at path
(re)generate templates that have a declared secret at path
( re ) generate templates that have a declared secret at path
pub async fn generate_templates(
		&self,
		secrets: &Secrets,
		path: &str,
		sender: &Sender<Message>,
	) -> Result<()> {
		for (tmpl, conf) in self.iter() {
			// if the secret is among the template declared secrets
			// and all template secrets are defined
			if conf.secrets.get(path).is_some()
				&& secrets
					.iter()
					.filter_map(|(path, val)| {
						if conf.secrets.get(path).is_some() {
							Some(val)
						} else {
							None
						}
					})
					.all(|o| o.is_some())
			{
				// fetch dynamic (exe) secrets before generating the template (dynamic secrets are always invalid)
				for (path, secret) in secrets.iter().filter_map(|(path, val)| {
					if conf.secrets.get(path).is_some() {
						Some((path, val))
					} else {
						None
					}
				}) {
					// fetch the secret without triggering template manifestation once again
					if secret.is_none() || !secret.as_ref().unwrap().is_valid() {
						sender
							.send(Message::GetSecret(path.to_owned(), false))
							.await?;
					}
				}
				// ask the broker to regenerate the template
				sender.send(Message::GenerateTemplate(tmpl.clone())).await?;
			}
		}
		Ok(())
	}
pub async fn generate_templates ( & self , secrets : & Secrets , path : & str , sender : & Sender < Message > , ) -> Result < ( ) > { for ( tmpl , conf ) in self . iter ( ) { // if the secret is among the template declared secrets // and all template secrets are defined if conf . secrets . get ( path ) . is_some ( ) && secrets . iter ( ) . filter_map ( | ( path , val ) | { if conf . secrets . get ( path ) . is_some ( ) { Some ( val ) } else { None } } ) . all ( | o | o . is_some ( ) ) { // fetch dynamic (exe) secrets before generating the template (dynamic secrets are always invalid) for ( path , secret ) in secrets . iter ( ) . filter_map ( | ( path , val ) | { if conf . secrets . get ( path ) . is_some ( ) { Some ( ( path , val ) ) } else { None } } ) { // fetch the secret without triggering template manifestation once again if secret . is_none ( ) || ! secret . as_ref ( ) . unwrap ( ) . is_valid ( ) { sender . send ( Message :: GetSecret ( path . to_owned ( ) , false ) ) . await ? ; } } // ask the broker to regenerate the template sender . send ( Message :: GenerateTemplate ( tmpl . clone ( ) ) ) . await ? ; } } Ok ( ( ) ) }
(re)generate templates that have a declared secret at path
( re ) generate templates that have a declared secret at path
&self
secrets
&Secrets
path
&str
sender
&Sender<Message>
&self
secrets
&Secrets
path
&str
sender
&Sender<Message>