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

сделал settings.txt

This commit is contained in:
Nikitin Aleksandr 2023-11-17 15:08:31 +03:00
parent d2f6700a09
commit 4cc1fe81d4
5 changed files with 29 additions and 4 deletions

View File

@ -32,7 +32,7 @@ Installation procedure:
make build make build
the crud_generator file will appear in the bin folder the crud_generator file will appear in the bin folder
2. Fill settings in the bin/settings.txt file 2. Fill settings in the bin/templates/configs_/settings.txt file
- connections to your database - connections to your database
- name of your new service - name of your new service
- URL of your new service - URL of your new service

View File

@ -6,7 +6,6 @@ import (
"github.com/ManyakRus/crud_generator/internal/folders" "github.com/ManyakRus/crud_generator/internal/folders"
"github.com/ManyakRus/crud_generator/internal/load_configs" "github.com/ManyakRus/crud_generator/internal/load_configs"
"github.com/ManyakRus/crud_generator/internal/logic" "github.com/ManyakRus/crud_generator/internal/logic"
ConfigMain "github.com/ManyakRus/starter/config"
"github.com/ManyakRus/starter/log" "github.com/ManyakRus/starter/log"
"github.com/ManyakRus/starter/postgres_gorm" "github.com/ManyakRus/starter/postgres_gorm"
) )
@ -16,7 +15,9 @@ func main() {
} }
func StartApp() { func StartApp() {
ConfigMain.LoadENV_or_SettingsTXT() //ConfigMain.LoadENV_or_SettingsTXT()
config.LoadSettingsTxt()
config.FillSettings() config.FillSettings()
config.FillFlags() config.FillFlags()

View File

@ -1,6 +1,9 @@
package config package config
import ( import (
"github.com/ManyakRus/crud_generator/internal/constants"
ConfigMain "github.com/ManyakRus/starter/config"
"github.com/ManyakRus/starter/micro"
"log" "log"
"os" "os"
"strings" "strings"
@ -186,3 +189,22 @@ func BoolFromString(s string) bool {
return Otvet return Otvet
} }
func LoadSettingsTxt() {
var err error
DirBin := micro.ProgramDir_bin()
Dir := DirBin + constants.SETTINGS_FOLDER_NAME + micro.SeparatorFile()
FilenameEnv := Dir + ".env"
err = ConfigMain.LoadEnv_from_file_err(FilenameEnv)
if err == nil {
return
}
FilenameSettings := Dir + "settings.txt"
err = ConfigMain.LoadEnv_from_file_err(FilenameSettings)
if err != nil {
log.Panic("LoadSettingsTxt() filename: ", FilenameSettings, " error: ", err)
}
}

View File

@ -14,3 +14,5 @@ const CONFIG_FOLDER_NAME = "configs_"
const TemplateFilenameCrudGo = "crud.go_" const TemplateFilenameCrudGo = "crud.go_"
const TemplateFilenameCrudGoTest = "crud_test.go_" const TemplateFilenameCrudGoTest = "crud_test.go_"
const SETTINGS_FOLDER_NAME = "templates/configs_"

View File

@ -33,7 +33,7 @@ create, read, update, save, delete (или delete + restore)
make build make build
в папке bin появится файл crud_generator в папке bin появится файл crud_generator
2. Заполнить найстройки в файле bin/settings.txt 2. Заполнить найстройки в файле bin/templates/configs_/settings.txt
- подключения к вашей базе данных - подключения к вашей базе данных
- имя вашего нового сервиса - имя вашего нового сервиса
- URL вашего нового сервиса - URL вашего нового сервиса