From 4283ab0c957c2f7395d5fee087e4845d1feb7be9 Mon Sep 17 00:00:00 2001 From: Shawna Monero <66325812+smonero@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:53:16 -0800 Subject: [PATCH] add to the global cfg (#726) --- server/config/raw/global_cfg.go | 19 +++++++++++++++++++ server/config/valid/global_cfg.go | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/server/config/raw/global_cfg.go b/server/config/raw/global_cfg.go index 70d1d556a..9f760ff44 100644 --- a/server/config/raw/global_cfg.go +++ b/server/config/raw/global_cfg.go @@ -26,6 +26,24 @@ type GlobalCfg struct { Persistence Persistence `yaml:"persistence" json:"persistence"` RevisionSetter RevisionSetter `yaml:"revision_setter" json:"revision_setter"` Admin Admin `yaml:"admin" json:"admin"` + TerraformAdminMode TerraformAdminMode `yaml:"terraform_admin_mode" json:"terraform_admin_mode"` +} + +type TerraformAdminMode struct { + Repo string `yaml:"repo" json:"repo"` + Root string `yaml:"root" json:"root"` +} + +func (t TerraformAdminMode) ToValid() valid.TerraformAdminMode { + return valid.TerraformAdminMode{ + Repo: t.Repo, + Root: t.Root, + } +} + +func (t TerraformAdminMode) Validate() error { + // We don't need to validate the inputs so we can just return nil + return nil } type GithubTeam struct { @@ -196,6 +214,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.ToValid(), } } diff --git a/server/config/valid/global_cfg.go b/server/config/valid/global_cfg.go index aa0bdfd6b..7c2b45f8b 100644 --- a/server/config/valid/global_cfg.go +++ b/server/config/valid/global_cfg.go @@ -64,6 +64,12 @@ type GlobalCfg struct { Github Github RevisionSetter RevisionSetter Admin Admin + TerraformAdminMode TerraformAdminMode +} + +type TerraformAdminMode struct { + Repo string + Root string } type GithubTeam struct {