1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-22 00:36:41 +02:00

сделал TEMPLATE_EXTERNAL_PROTO_FILENAME

This commit is contained in:
Nikitin Aleksandr 2024-01-17 14:13:10 +03:00
parent df086bec0b
commit 1fe4705d7b
2 changed files with 7 additions and 2 deletions

View File

@ -32,6 +32,9 @@ type SettingsINI struct {
TEMPLATE_FOLDERNAME_CRUD_STARTER string
TEMPLATE_FOLDERNAME_ALIAS string
TEMPLATE_FOLDER_CRUD_FUNCTIONS string
TEMPLATE_FOLDERNAME_MAIN string
TEMPLATE_REPOSITORY_URL string
TEMPLATE_EXTERNAL_PROTO_FILENAME string
NEED_CREATE_MODEL_STRUCT bool
NEED_CREATE_MODEL_CRUD bool
NEED_CREATE_DB bool
@ -58,8 +61,6 @@ type SettingsINI struct {
PREFIX_MODEL string
COMMENT_MODEL_STRUCT string
TEXT_MODULE_GENERATED string
TEMPLATE_FOLDERNAME_MAIN string
TEMPLATE_REPOSITORY_URL string
PREFIX_TABLE string
}
@ -163,6 +164,7 @@ func FillSettings() {
Settings.PREFIX_MODEL = os.Getenv("PREFIX_MODEL")
Settings.TEMPLATE_FOLDERNAME_DB = os.Getenv("TEMPLATE_FOLDERNAME_DB")
Settings.TEMPLATE_FOLDER_CRUD_FUNCTIONS = os.Getenv("TEMPLATE_FOLDER_CRUD_FUNCTIONS")
Settings.TEMPLATE_EXTERNAL_PROTO_FILENAME = os.Getenv("TEMPLATE_EXTERNAL_PROTO_FILENAME")
}

View File

@ -42,6 +42,9 @@ func CreateFileProto(MapAll map[string]*types.Table) error {
folders.CreateFolder(DirReadyProto)
FilenameTemplateProto := DirTemplatesProto + "service.proto_"
if config.Settings.TEMPLATE_EXTERNAL_PROTO_FILENAME != "" {
FilenameTemplateProto = config.Settings.TEMPLATE_EXTERNAL_PROTO_FILENAME
}
bytes, err := os.ReadFile(FilenameTemplateProto)
if err != nil {
log.Panic("ReadFile() ", FilenameTemplateProto, " error: ", err)