diff --git a/conf/config.yml b/conf/config.yml index de15d36..a100b46 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -9,3 +9,9 @@ grpcInnerAddress: port: 9005 moduleName: system instanceUuid: 3f4faf30-8482-48ef-931a-b15575a3af1d + +logfile: + path: /var/log/isp-system-service/runtime.log + maxSizeMb: 512 + maxBackups: 4 + compress: true \ No newline at end of file diff --git a/conf/default_remote_config.json b/conf/default_remote_config.json index db16e57..a1de5ea 100644 --- a/conf/default_remote_config.json +++ b/conf/default_remote_config.json @@ -1,12 +1,12 @@ { + "logLevel": "debug", "database": { - "address": "127.0.0.1", - "port": "5432", - "schema": "system_service", - "database": "name", - "username": "name", - "password": "password", - "createSchema": true + "schema": "mdm_service", + "database": "{{ msp_pgsql_name }}", + "password": "{{ msp_pgsql_password }}", + "username": "{{ msp_pgsql_user }}", + "host": "{{ msp_pgsql_address }}", + "port": 5432 }, "redis": { "address": { @@ -15,14 +15,5 @@ }, "defaultDB": 0 }, - "metrics": { - "gc": true, - "memory": true, - "address": { - "ip": "0.0.0.0", - "path": "/metrics", - "port": "9555" - } - }, "applicationSecret": "SECRET_ACCESS_KEY" } \ No newline at end of file diff --git a/conf/local.go b/conf/local.go new file mode 100644 index 0000000..5a55fda --- /dev/null +++ b/conf/local.go @@ -0,0 +1,10 @@ +package conf + +import ( + "github.com/integration-system/isp-kit/bootstrap" +) + +type Local struct { + *bootstrap.LocalConfig + InstanceUuid string +} diff --git a/conf/local_config.go b/conf/local_config.go deleted file mode 100644 index d63a566..0000000 --- a/conf/local_config.go +++ /dev/null @@ -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 - InstanceUuid string - GrpcOuterAddress structure.AddressConfiguration `valid:"required~Required" json:"grpcOuterAddress"` - GrpcInnerAddress structure.AddressConfiguration `valid:"required~Required" json:"grpcInnerAddress"` -} diff --git a/conf/remote.go b/conf/remote.go new file mode 100644 index 0000000..ca7c20a --- /dev/null +++ b/conf/remote.go @@ -0,0 +1,26 @@ +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/isp-lib/v2/structure" + "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 `schema:"Настройка базы данных"` + LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования"` + Redis structure.RedisConfiguration `schema:"Настройка Redis" valid:"required~Required"` + DefaultTokenExpireTime int `schema:"Время жизни токена по умолчанию,время жизни токена в миллисекундах с момента его создания. если = -1 - время жизни неограниченно"` + ApplicationSecret string `schema:"Ключ для подписи application токенов" valid:"required~Required"` +} diff --git a/conf/remoteConfig.go b/conf/remoteConfig.go deleted file mode 100644 index 69781e5..0000000 --- a/conf/remoteConfig.go +++ /dev/null @@ -1,13 +0,0 @@ -package conf - -import ( - "github.com/integration-system/isp-lib/v2/structure" -) - -type RemoteConfig struct { - Database structure.DBConfiguration `schema:"Настройка базы данных"` - Redis structure.RedisConfiguration `schema:"Настройка Redis" valid:"required~Required"` - DefaultTokenExpireTime int64 `schema:"Время жизни токена по умолчанию,время жизни токена в миллисекундах с момента его создания. если = -1 - время жизни неограниченно"` - Metrics structure.MetricConfiguration `schema:"Настройка метрик"` - ApplicationSecret string `schema:"Ключ для подписи application токенов" valid:"required~Required"` -}