MSP-1068 refactor config
This commit is contained in:
1 parent
ca8d278566
commit
06818e5616
5 files changed
+48
-53
No files matched your search
+8
-4
@@ -7,7 +7,11 @@ grpcOuterAddress:
|
||||
grpcInnerAddress:
|
||||
ip: 0.0.0.0
|
||||
port: 9007
|
||||
webSocketAddress:
|
||||
ip: 0.0.0.0
|
||||
port: 9100
|
||||
moduleName: admin
|
||||
moduleName: msp-admin-service
|
||||
infraServerPort: 9557
|
||||
|
||||
logfile:
|
||||
path: /var/log/msp-admin-service/runtime.log
|
||||
maxSizeMb: 512
|
||||
maxBackups: 4
|
||||
compress: true
|
||||
@@ -5,17 +5,9 @@
|
||||
"username": "name",
|
||||
"createSchema": true,
|
||||
"port": "5432",
|
||||
"schema": "admin_service",
|
||||
"schema": "msp_admin_service",
|
||||
"address": "127.0.0.1"
|
||||
},
|
||||
"metrics": {
|
||||
"gc": true,
|
||||
"memory": true,
|
||||
"address": {
|
||||
"path": "/metrics",
|
||||
"port": "9557",
|
||||
"ip": "0.0.0.0"
|
||||
}
|
||||
},
|
||||
"logLevel": "debug",
|
||||
"secretKey": "secret"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/v2/config"
|
||||
"github.com/integration-system/isp-lib/v2/structure"
|
||||
)
|
||||
|
||||
type Configuration struct {
|
||||
config.CommonLocalConfig
|
||||
GrpcOuterAddress structure.AddressConfiguration `valid:"required~Required"`
|
||||
GrpcInnerAddress structure.AddressConfiguration `valid:"required~Required"`
|
||||
WebSocketAddress structure.AddressConfiguration `valid:"required~Required"` //TODO : оставить поле - после модификации гейта, вернёмся к использованию
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/integration-system/isp-kit/dbx"
|
||||
"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 {
|
||||
Database dbx.Config
|
||||
SecretKey string `valid:"required~Required" schema:"JWT secret"`
|
||||
ExpireSec int `schema:"Token expire time,in seconds"`
|
||||
UiDesign UIDesign `schema:"Кастомизация интерфейса"`
|
||||
SudirAuth *SudirAuth `schema:"СУДИР авторизация"`
|
||||
LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования"`
|
||||
}
|
||||
|
||||
type UIDesign struct {
|
||||
Name string `schema:"Название стенда"`
|
||||
PrimaryColor string `schema:"Цвет в HEX, примеры: #ff4d4f #fa8c16 #a0d911 #1890ff #722ed1 #d4b106 #e91e63 #ff5722 #795548 #abb8c3 #525252 #689f38"`
|
||||
}
|
||||
|
||||
type SudirAuth struct {
|
||||
ClientId string `valid:"required~Required"`
|
||||
ClientSecret string `valid:"required~Required"`
|
||||
Host string `valid:"required~Required" schema:"Хост, пример https://sudir.mos.ru"`
|
||||
RedirectURI string `valid:"required~Required"`
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/v2/structure"
|
||||
)
|
||||
|
||||
type RemoteConfig struct {
|
||||
Database structure.DBConfiguration `valid:"required~Required" json:"database" schema:"Database"`
|
||||
Metrics structure.MetricConfiguration `schema:"Metrics"`
|
||||
SecretKey string `valid:"required~Required" schema:"JWT secret"`
|
||||
ExpireSec int `schema:"Token expire time,in seconds"`
|
||||
UiDesign UIDesign `schema:"Кастомизация интерфейса"`
|
||||
SudirAuth *SudirAuth `schema:"СУДИР авторизация"`
|
||||
}
|
||||
|
||||
type UIDesign struct {
|
||||
Name string `schema:"Название стенда"`
|
||||
PrimaryColor string `schema:"Цвет в HEX, примеры: #ff4d4f #fa8c16 #a0d911 #1890ff #722ed1 #d4b106 #e91e63 #ff5722 #795548 #abb8c3 #525252 #689f38"`
|
||||
}
|
||||
|
||||
type SudirAuth struct {
|
||||
ClientId string `valid:"required~Required"`
|
||||
ClientSecret string `valid:"required~Required"`
|
||||
Host string `valid:"required~Required" schema:"Хост, пример https://sudir.mos.ru"`
|
||||
RedirectURI string `valid:"required~Required"`
|
||||
}
|
||||
Reference in new issue
Block a user