rename arguments in args

This commit is contained in:
mr 2024-07-30 14:41:33 +02:00
parent 86c3e83eda
commit b06193add2

View File

@ -6,6 +6,7 @@ import (
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
"cloud.o-forge.io/core/oc-lib/logs"
"cloud.o-forge.io/core/oc-lib/models"
"cloud.o-forge.io/core/oc-lib/models/resource_model"
"cloud.o-forge.io/core/oc-lib/models/resources/data"
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
"cloud.o-forge.io/core/oc-lib/models/resources/processing"
@ -55,6 +56,31 @@ func Init(appName string) {
logs.SetAppName(appName)
logs.SetLogger(logs.CreateLogger("main", ""))
mongo.MONGOService.Init(models.GetModelsNames(), GetConfig())
accessor := (&resource_model.ResourceModel{}).GetAccessor()
for _, model := range []string{utils.DATA_RESOURCE.String(), utils.PROCESSING_RESOURCE.String(), utils.STORAGE_RESOURCE.String(), utils.DATACENTER_RESOURCE.String(), utils.WORKFLOW_RESOURCE.String()} {
data, code, _ := accessor.Search(model)
if code == 404 || len(data) == 0 {
m := map[string]resource_model.Model{}
if model == utils.PROCESSING_RESOURCE.String() {
m["image"] = resource_model.Model{
Type: "string",
ReadOnly: false,
}
m["command"] = resource_model.Model{
Type: "string",
ReadOnly: false,
}
m["args"] = resource_model.Model{
Type: "string",
ReadOnly: false,
}
}
accessor.StoreOne(&resource_model.ResourceModel{
ResourceType: model,
Model: m,
})
}
}
}
func GetLogger() zerolog.Logger {