modify the service name from proto (#230)

This commit is contained in:
Keson
2020-11-28 11:48:44 +08:00
committed by GitHub
parent 3ebb1e0221
commit 2dfecda465
3 changed files with 15 additions and 8 deletions

View File

@@ -22,7 +22,7 @@ Etcd:
func (g *defaultGenerator) GenEtc(ctx DirContext, _ parser.Proto, cfg *conf.Config) error {
dir := ctx.GetEtc()
etcFilename, err := format.FileNamingFormat(cfg.NamingFormat, ctx.GetMain().Base)
etcFilename, err := format.FileNamingFormat(cfg.NamingFormat, ctx.GetServiceName().Source())
if err != nil {
return err
}
@@ -35,6 +35,6 @@ func (g *defaultGenerator) GenEtc(ctx DirContext, _ parser.Proto, cfg *conf.Conf
}
return util.With("etc").Parse(text).SaveTo(map[string]interface{}{
"serviceName": strings.ToLower(stringx.From(ctx.GetMain().Base).ToCamel()),
"serviceName": strings.ToLower(stringx.From(ctx.GetServiceName().Source()).ToCamel()),
}, fileName, false)
}