fix: yaml tag
This commit is contained in:
+10
-12
@@ -1,13 +1,11 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"gopkg.in/yaml.v3"
|
||||
"io/ioutil"
|
||||
|
||||
"git.icechen.cn/pkg/wujian_develop_tool/util"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
var DefaultConfigFile = ".drone.yml"
|
||||
@@ -43,9 +41,9 @@ type ConfigFile struct {
|
||||
type (
|
||||
ApiList []Api
|
||||
Api struct {
|
||||
NameSpace string `json:"name_space" yaml:"nameSpace"`
|
||||
Namespace string `json:"namespace" yaml:"namespace"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
AliasName string `json:"alias_name" yaml:"aliasName"`
|
||||
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"`
|
||||
@@ -57,9 +55,9 @@ type (
|
||||
type (
|
||||
ServiceList []Service
|
||||
Service struct {
|
||||
NameSpace string `json:"name_space" yaml:"nameSpace"`
|
||||
Namespace string `json:"namespace" yaml:"namespace"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
AliasName string `json:"alias_name" yaml:"aliasName"`
|
||||
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"`
|
||||
@@ -83,7 +81,7 @@ func ReadConfig() error {
|
||||
func (c *ConfigFile) AppendAPI(api Api) error {
|
||||
has := false
|
||||
for i, a := range c.Api {
|
||||
if a.Name == api.Name && a.NameSpace == api.NameSpace {
|
||||
if a.Name == api.Name && a.Namespace == api.Namespace {
|
||||
c.Api[i] = api
|
||||
has = true
|
||||
break
|
||||
@@ -105,7 +103,7 @@ func (c *ConfigFile) AppendAPI(api Api) error {
|
||||
func (c *ConfigFile) AppendService(service Service) error {
|
||||
has := false
|
||||
for i, s := range c.Service {
|
||||
if s.Name == service.Name && s.NameSpace == service.NameSpace {
|
||||
if s.Name == service.Name && s.Namespace == service.Namespace {
|
||||
c.Service[i] = service
|
||||
has = true
|
||||
break
|
||||
@@ -145,7 +143,7 @@ al:
|
||||
|
||||
func (sl ApiList) GetApp(namespace, appName string) Api {
|
||||
for _, api := range sl {
|
||||
if api.Name == appName && api.NameSpace == namespace {
|
||||
if api.Name == appName && api.Namespace == namespace {
|
||||
return api
|
||||
}
|
||||
}
|
||||
@@ -173,7 +171,7 @@ sl:
|
||||
|
||||
func (sl ServiceList) GetApp(namespace, appName string) Service {
|
||||
for _, service := range sl {
|
||||
if service.Name == appName && service.NameSpace == namespace {
|
||||
if service.Name == appName && service.Namespace == namespace {
|
||||
return service
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user