From 56f78e083a842a130a815a17ce08692bf6907237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Cluseau?= Date: Sun, 25 Jan 2026 20:30:49 +0100 Subject: [PATCH] config.FileDef: add Content64 for base64-encoded content --- config/config.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index e4ade79..8f6b79e 100644 --- a/config/config.go +++ b/config/config.go @@ -1,6 +1,7 @@ package config import ( + "encoding/base64" "fmt" "io" "net" @@ -133,11 +134,12 @@ type UserDef struct { } type FileDef struct { - Path string - Mode os.FileMode - Content string - Symlink string - Dir bool + Path string + Mode os.FileMode + Content string + Content64 string + Symlink string + Dir bool } type NetworkDef struct { @@ -158,6 +160,13 @@ type NetworkDef struct { func (c *Config) FileContent(filePath string) []byte { for _, f := range c.Files { if f.Path == filePath { + if f.Content64 != "" { + decoded, err := base64.StdEncoding.DecodeString(f.Content64) + if err != nil { + panic(fmt.Errorf("invalid base64 content in file %s", f.Path)) + } + return decoded + } return []byte(f.Content) } }