icechen e38bf7e1af
All checks were successful
continuous-integration/drone/push Build is passing
feat: 增加namespace
2022-01-10 17:51:52 +08:00

38 lines
818 B
Go

package config_handler
import (
"git.icechen.cn/pkg/drone_plugin/consts"
"git.icechen.cn/pkg/drone_plugin/go_handler"
)
func (al ApiList) toDestinationConfig(deployEnv consts.Env) (string, error) {
retConfig := ""
for _, api := range al {
config, err := api.toDestinationConfig(deployEnv)
if err != nil {
return "", err
}
retConfig += config + "\n\n---\n\n"
}
return retConfig, nil
}
func (a Api) toDestinationConfig(deployEnv consts.Env) (string, error) {
var handler Handler
switch a.Type {
case go_handler.TypeGolang:
handler = go_handler.GoApiHandler{
NameSpace: a.Namespace,
Name: a.Name,
AliasName: a.AliasName,
Root: a.Root,
Port: a.Port,
Host: a.Host,
Path: a.Path,
DeployEnv: deployEnv,
}
}
return handler.ToDestinationConfig()
}