package config_handler import ( "git.icechen.cn/pkg/drone_plugin/git" "gopkg.in/yaml.v3" ) const TypeMonorepo = "monorepo" // 单库类型 type Config struct { Kind string `json:"kind" yaml:"kind"` Type string `json:"type" yaml:"type"` Name string `json:"name" yaml:"name"` Api ApiList `json:"api" yaml:"api"` Service ServiceList `json:"service" yaml:"service"` } type ( ApiList []Api Api struct { Namespace string `json:"namespace" yaml:"namespace"` Name string `json:"name" yaml:"name"` AliasName string `json:"alias_name" yaml:"alias_name"` Root string `json:"root" yaml:"root"` Type string `json:"type" yaml:"type"` Port string `json:"port" yaml:"port"` Host string `json:"host" yaml:"host"` Path string `json:"path" yaml:"path"` } ) type ( ServiceList []Service Service struct { Namespace string `json:"namespace" yaml:"namespace"` Name string `json:"name" yaml:"name"` AliasName string `json:"alias_name" yaml:"alias_name"` Root string `json:"root" yaml:"root"` Type string `json:"type" yaml:"type"` Port string `json:"port" yaml:"port"` } ) // getRealConfig 获取原始配置文件内容 func getRealConfig(client git.Client) (Config, error) { var c Config realConfigContent, err := client.GetRealConfig() if err != nil { return c, err } err = yaml.Unmarshal([]byte(realConfigContent), &c) return c, err }