MSP-1021 refactor conf
This commit is contained in:
1 parent
00763dc8d0
commit
f62f6bb4e6
4 files changed
+37
-25
No files matched your search
@@ -8,3 +8,10 @@ grpcInnerAddress:
|
|||||||
ip: 0.0.0.0
|
ip: 0.0.0.0
|
||||||
port: 9024
|
port: 9024
|
||||||
moduleName: script
|
moduleName: script
|
||||||
|
infraServerPort: 9574
|
||||||
|
|
||||||
|
logfile:
|
||||||
|
path: /var/log/isp-script-service/runtime.log
|
||||||
|
maxSizeMb: 512
|
||||||
|
maxBackups: 4
|
||||||
|
compress: true
|
||||||
@@ -1,15 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"logLevel": "debug",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
],
|
],
|
||||||
"sharedScript": "",
|
"sharedScript": "",
|
||||||
"scriptExecutionTimeoutMs": 1000,
|
"scriptExecutionTimeoutMs": 1000
|
||||||
"metrics": {
|
|
||||||
"gc": true,
|
|
||||||
"memory": true,
|
|
||||||
"address": {
|
|
||||||
"port": "9574",
|
|
||||||
"ip": "0.0.0.0",
|
|
||||||
"path": "/metrics"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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"`
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package conf
|
|
||||||
|
|
||||||
import "github.com/integration-system/isp-lib/v2/structure"
|
|
||||||
|
|
||||||
type RemoteConfig struct {
|
|
||||||
Scripts []ScriptDefinition
|
|
||||||
SharedScript string
|
|
||||||
ScriptExecutionTimeoutMs int `valid:"required~Required"`
|
|
||||||
Metrics structure.MetricConfiguration
|
|
||||||
}
|
|
||||||
|
|
||||||
type ScriptDefinition struct {
|
|
||||||
Id string `valid:"required~Required"`
|
|
||||||
Script string `valid:"required~Required"`
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user