modules/client: Vendor config directory if present
authorJoe Mooring <joe.mooring@veriphor.com>
Tue, 5 Apr 2022 17:36:08 +0000 (10:36 -0700)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 5 Apr 2022 18:39:04 +0000 (20:39 +0200)
Fixes #9751

modules/client.go

index eab871d01b0637058c97ea91fb045aa4750635cf..6e1cfe881c386c6d493c6ba9dc28ef465db41ba0 100644 (file)
@@ -282,6 +282,15 @@ func (c *Client) Vendor() error {
                        }
                }
 
+               // Include the config directory if present.
+               configDir := filepath.Join(dir, "config")
+               _, err = c.fs.Stat(configDir)
+               if err == nil {
+                       if err := hugio.CopyDir(c.fs, configDir, filepath.Join(vendorDir, t.Path(), "config"), nil); err != nil {
+                               return errors.Wrap(err, "failed to copy config dir to vendor dir")
+                       }
+               }
+
                // Also include any theme.toml or config.* files in the root.
                configFiles, _ := afero.Glob(c.fs, filepath.Join(dir, "config.*"))
                configFiles = append(configFiles, filepath.Join(dir, "theme.toml"))