From fe8ead24a50181d1a593b9b3b88e562cd247462f Mon Sep 17 00:00:00 2001 From: Shawna Monero Date: Tue, 13 Feb 2024 10:10:48 -0800 Subject: [PATCH] add in other places --- server/config/raw/global_cfg.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/server/config/raw/global_cfg.go b/server/config/raw/global_cfg.go index a2cf56e57..d670efaba 100644 --- a/server/config/raw/global_cfg.go +++ b/server/config/raw/global_cfg.go @@ -34,10 +34,19 @@ type TerraformAdminMode struct { Root string `yaml:"root" json:"root"` } -type (t TerraformAdminMode) Validate() error { - return validation.ValidateStruct( - &t, +func (t TerraformAdminMode) ToValid() valid.TerraformAdminMode { + return valid.TerraformAdminMode{ + Repo: t.Repo, + Root: t.Root, + } +} +func (t TerraformAdminMode) Validate() error { + return validation.ValidateStruct(&t, + validation.Field(&t.Repo), + validation.Field(&t.Root), + ) +} type GithubTeam struct { Name string `yaml:"name" json:"name"` @@ -207,7 +216,7 @@ func (g GlobalCfg) ToValid(defaultCfg valid.GlobalCfg) valid.GlobalCfg { Github: g.Github.ToValid(), Admin: g.Admin.ToValid(), RevisionSetter: g.RevisionSetter.ToValid(), - TerraformAdminMode: g.TerraformAdminMode, + TerraformAdminMode: g.TerraformAdminMode.ToValid(), } }