automatic create global requirements txt if not exists
parent
f09391b21f
commit
6c033a0fb6
29
main.go
29
main.go
|
@ -56,6 +56,7 @@ func init() {
|
||||||
|
|
||||||
createServerDirectoriesIfNotExists()
|
createServerDirectoriesIfNotExists()
|
||||||
createLogLanguageFilesIfNotExist()
|
createLogLanguageFilesIfNotExist()
|
||||||
|
createGlobalRequirementsTxtIfNotExists()
|
||||||
|
|
||||||
utils.ValidatorInit()
|
utils.ValidatorInit()
|
||||||
logger.InitLanguageLogMessages()
|
logger.InitLanguageLogMessages()
|
||||||
|
@ -175,6 +176,34 @@ MARIADB_DATABASE_NAME=db_database_name`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create global requirements.txt in cfg.PublicStatic groupTasks folder
|
||||||
|
func createGlobalRequirementsTxtIfNotExists() {
|
||||||
|
cfg := config.Cfg.FolderPaths
|
||||||
|
filePath := cfg.GroupTasksGroups + "requirements.txt"
|
||||||
|
|
||||||
|
_, err := os.Stat(filePath)
|
||||||
|
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
file, err := os.Create(filePath)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msgf("Failed to create global requirements.txt file: %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
_, err = file.WriteString("# HERE YOU CAN DEFINE GLOBAL REQUIREMENTS\n# WHICH WILL BE INSTALLED ON THE SAME WAY AS THE GROUP TASKS REQUIREMENTS,\n# BUT YOU DON'T HAVE TO DEFINE THEM IN EVERY GROUP TASK\n")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Msgf("Failed to write to requirements.txt file: %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info().Msgf("Created global requirements.txt file")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func createServerDirectoriesIfNotExists() {
|
func createServerDirectoriesIfNotExists() {
|
||||||
cfg := config.Cfg.FolderPaths
|
cfg := config.Cfg.FolderPaths
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue