2024-06-03 12:49:17: merge [main:72fad31e37b51d75b8c23bb36393fb2548694cec];

This commit is contained in:
txix committed 2024-06-03 12:49:17 +03:00
1 parent 0a91198eb6
commit bc88a51ec4
28 files changed
+1355

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
configServiceAddress:
ip: 127.0.0.1
port: 9001
grpcOuterAddress:
#ip: 127.0.0.1
port: 9740
grpcInnerAddress:
ip: 0.0.0.0
port: 9740
moduleName: isp-lock-service
logfile:
path: /var/log/isp-lock-service/runtime.log
maxSizeMb: 512
maxBackups: 4
compress: true
+9
View File
@@ -0,0 +1,9 @@
{
"logLevel": "debug",
"redis": {
"address": "{{ msp_redis_address }}:{{ msp_redis_port }}",
"password": "",
"db": 0,
"prefix": "isp-lock-service"
}
}
+39
View File
@@ -0,0 +1,39 @@
package conf
import (
"reflect"
"github.com/txix-open/isp-kit/log"
"github.com/txix-open/isp-kit/rc/schema"
"github.com/txix-open/jsonschema"
)
// nolint: gochecknoinits
func init() {
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, s *jsonschema.Schema) {
s.Type = "string"
s.Enum = []any{"debug", "info", "error", "fatal"}
})
}
type Remote struct {
LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования"`
Redis Redis `schema:"Настройки redis"`
}
type Redis struct {
Address string `schema:"Адрес,обязательное, если sentinel не указан"`
Username string `schema:"Имя пользователя"`
Password string `schema:"Пароль"`
Sentinel *RedisSentinel `schema:"Настройки sentinel,обязательно, если address не указан"`
Db int `schema:"номер БД в redis"`
Prefix string `schema:"Префикс ключей для модуля"`
}
type RedisSentinel struct {
Addresses []string `validate:"required" schema:"Адреса нод в кластере"`
MasterName string `validate:"required" schema:"Имя мастера"`
Username string `schema:"Имя пользователя в sentinel"`
Password string `schema:"Пароль в sentinel"`
}
+14
View File
@@ -0,0 +1,14 @@
package conf_test
import (
"testing"
"isp-lock-service/conf"
"github.com/txix-open/isp-kit/test/rct"
)
func TestDefaultRemoteConfig(t *testing.T) {
t.Parallel()
rct.Test(t, "default_remote_config.json", conf.Remote{})
}