MSP-1021 refactor conf
This commit is contained in:
1 parent
00763dc8d0
commit
f62f6bb4e6
4 files changed
+37
-25
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/integration-system/isp-kit/log"
|
||||
"github.com/integration-system/isp-kit/rc/schema"
|
||||
"github.com/integration-system/jsonschema"
|
||||
)
|
||||
|
||||
func init() {
|
||||
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Type) {
|
||||
t.Type = "string"
|
||||
t.Enum = []interface{}{"debug", "info", "error", "fatal"}
|
||||
})
|
||||
}
|
||||
|
||||
type Remote struct {
|
||||
LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования"`
|
||||
Scripts []ScriptDefinition
|
||||
SharedScript string
|
||||
ScriptExecutionTimeoutMs int `valid:"required~Required"`
|
||||
}
|
||||
|
||||
type ScriptDefinition struct {
|
||||
Id string `valid:"required~Required"`
|
||||
Script string `valid:"required~Required"`
|
||||
}
|
||||
Reference in new issue
Block a user