9
tools/goctl/api/gogen/config.tpl
Normal file
9
tools/goctl/api/gogen/config.tpl
Normal file
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
import {{.authImport}}
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
{{.auth}}
|
||||
{{.jwtTrans}}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package gogen
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -11,17 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
configFile = "config"
|
||||
configTemplate = `package config
|
||||
|
||||
import {{.authImport}}
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
{{.auth}}
|
||||
{{.jwtTrans}}
|
||||
}
|
||||
`
|
||||
configFile = "config"
|
||||
|
||||
jwtTemplate = ` struct {
|
||||
AccessSecret string
|
||||
@@ -35,6 +26,9 @@ type Config struct {
|
||||
`
|
||||
)
|
||||
|
||||
//go:embed config.tpl
|
||||
var configTemplate string
|
||||
|
||||
func genConfig(dir string, cfg *config.Config, api *spec.ApiSpec) error {
|
||||
filename, err := format.FileNamingFormat(cfg.NamingFormat, configFile)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user