Kevin Wan 2 years ago committed by GitHub
parent c638fce31c
commit d20d8324e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 {

Loading…
Cancel
Save