files: add content64 for base64 encoded values
This commit is contained in:
@@ -15,6 +15,11 @@ pub async fn files(files: &[crate::File], root: &str) -> Result<()> {
|
||||
use crate::FileKind as K;
|
||||
match &file.kind {
|
||||
K::Content(content) => fs::write(path, content.as_bytes()).await?,
|
||||
K::Content64(content) => {
|
||||
use base64::prelude::{Engine as _, BASE64_STANDARD as B64};
|
||||
let content = B64.decode(content)?;
|
||||
fs::write(path, content).await?
|
||||
}
|
||||
K::Dir(true) => fs::create_dir(path).await?,
|
||||
K::Dir(false) => {} // shouldn't happen, but semantic is to ignore
|
||||
K::Symlink(tgt) => fs::symlink(tgt, path).await?,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
pub mod apply;
|
||||
pub mod proxy;
|
||||
pub mod bootstrap;
|
||||
pub mod dls;
|
||||
pub mod dynlay;
|
||||
pub mod fs;
|
||||
pub mod logger;
|
||||
pub mod proxy;
|
||||
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
|
||||
pub struct Config {
|
||||
@@ -63,9 +63,10 @@ pub struct File {
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum FileKind {
|
||||
Content(String),
|
||||
Content64(String),
|
||||
Symlink(String),
|
||||
Dir(bool),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user