libct/configs: add HookList.SetDefaultEnv

1. Make CommandHook.Command a pointer, which reduces the amount of data
   being copied when using hooks, and allows to modify command hooks.

2. Add SetDefaultEnv, which is to be used by the next commit.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2024-12-22 17:32:02 -08:00
committed by lfbzhm
parent c49b891681
commit 6171da6005
6 changed files with 29 additions and 15 deletions
+3 -3
View File
@@ -31,14 +31,14 @@ func TestFactoryLoadContainer(t *testing.T) {
id = "1"
expectedHooks = configs.Hooks{
configs.Prestart: configs.HookList{
configs.CommandHook{Command: configs.Command{Path: "prestart-hook"}},
configs.CommandHook{Command: &configs.Command{Path: "prestart-hook"}},
},
configs.Poststart: configs.HookList{
configs.CommandHook{Command: configs.Command{Path: "poststart-hook"}},
configs.CommandHook{Command: &configs.Command{Path: "poststart-hook"}},
},
configs.Poststop: configs.HookList{
unserializableHook{},
configs.CommandHook{Command: configs.Command{Path: "poststop-hook"}},
configs.CommandHook{Command: &configs.Command{Path: "poststop-hook"}},
},
}
expectedConfig = &configs.Config{