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
|
package gogen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -11,17 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
configFile = "config"
|
configFile = "config"
|
||||||
configTemplate = `package config
|
|
||||||
|
|
||||||
import {{.authImport}}
|
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
rest.RestConf
|
|
||||||
{{.auth}}
|
|
||||||
{{.jwtTrans}}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
jwtTemplate = ` struct {
|
jwtTemplate = ` struct {
|
||||||
AccessSecret string
|
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 {
|
func genConfig(dir string, cfg *config.Config, api *spec.ApiSpec) error {
|
||||||
filename, err := format.FileNamingFormat(cfg.NamingFormat, configFile)
|
filename, err := format.FileNamingFormat(cfg.NamingFormat, configFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user