From 82bccb9d1fe3cc89545f15f788dda50bc7d58a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20B=C3=BClow?= Date: Wed, 31 Jan 2024 09:05:13 +0100 Subject: [PATCH] now allowes to specify skel target in config --- exampleconfig.yaml | 1 + pods/skel.go | 14 +++++++++----- readConfig.go | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/exampleconfig.yaml b/exampleconfig.yaml index 2c49a22..b527acf 100644 --- a/exampleconfig.yaml +++ b/exampleconfig.yaml @@ -16,6 +16,7 @@ maxage: 10800 port: 80 # Files that will be copied into container on startup skel: /etc/podterminal/skel.tar.gz +skel_target: /config ssl: false ssl_cert: /etc/ssl/certs/ssl-cert-snakeoil.pem ssl_cert_key: /etc/ssl/private/ssl-cert-snakeoil.key diff --git a/pods/skel.go b/pods/skel.go index b48d121..095108d 100644 --- a/pods/skel.go +++ b/pods/skel.go @@ -18,19 +18,23 @@ func CopySkelToContainer(id string) error { if err != nil { return err } + + fileInfo, err := os.Stat(viper.GetString("skel")) + if err != nil { + log.Println("Could not access Skel archive") + return err + } + log.Println("Skel Archive is ", fileInfo.Size(), "b") + file, err := os.Open(viper.GetString("skel")) if err != nil { log.Println("Could not open skel archive", err) return err } - - fileInfo, err := os.Stat(viper.GetString("skel")) - log.Println("Skel Archive is ", fileInfo.Size(), "b") - defer file.Close() params := url.Values{} - params.Set("path", "/") + params.Set("path", viper.GetString("skel_target")) response, err := conn.DoRequest( Socket, diff --git a/readConfig.go b/readConfig.go index 3adb0ef..2f604cb 100644 --- a/readConfig.go +++ b/readConfig.go @@ -17,6 +17,7 @@ func readConfigFile() { viper.SetDefault("dri", false) viper.SetDefault("dir_node", "/dev/dri/renderD128") viper.SetDefault("skel", "/etc/podterminal/skel.tar.gz") + viper.SetDefault("skel_target", "/") viper.SetDefault("block_filebrowser", false) viper.SetDefault("envvars", map[string]string{