diff --git a/conf/default_remote_config.json b/conf/default_remote_config.json index 1af8868..4287ce7 100644 --- a/conf/default_remote_config.json +++ b/conf/default_remote_config.json @@ -1,4 +1,32 @@ { + "audit": { + "eventSettings": [ + { + "event": "success_login", + "name": "Успешный вход" + }, + { + "event": "error_login", + "name": "Неуспешный вход" + }, + { + "event": "success_logout", + "name": "Успешный выход" + }, + { + "event": "role_changed", + "name": "Изменение роли" + }, + { + "event": "user_changed", + "name": "Изменение пользователя" + } + ], + "auditTTl": { + "timeToLiveInMin": 525600, + "expireSyncPeriodInMin": 1440 + } + }, "database": { "host": "{{ msp_pgsql_address }}", "port": 5432, @@ -9,11 +37,11 @@ }, "logLevel": "debug", "antiBruteforce": { - "maxInFlightLoginRequests" : 3, + "maxInFlightLoginRequests": 3, "delayLoginRequestInSec": 3 }, "expireSec": 3600, - "blockInactiveWorker" : { + "blockInactiveWorker": { "daysThreshold": 90, "runIntervalInMinutes": 60 } diff --git a/conf/remote.go b/conf/remote.go index 1a53aed..be7c371 100644 --- a/conf/remote.go +++ b/conf/remote.go @@ -9,7 +9,8 @@ import ( "github.com/integration-system/jsonschema" ) -func init() { +// nolint: gochecknoinits +func init() { // schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Type) { t.Type = "string" t.Enum = []interface{}{"debug", "info", "error", "fatal"} @@ -17,6 +18,7 @@ func init() { } type Remote struct { + Audit Audit Database dbx.Config ExpireSec int `valid:"required" schema:"Время жизни токена в секундах,in seconds"` UiDesign UIDesign `schema:"Кастомизация интерфейса"` @@ -27,6 +29,21 @@ type Remote struct { Permissions []Permission } +type Audit struct { + EventSettings []AuditEventSetting + AuditTTl AuditTTlSetting +} + +type AuditTTlSetting struct { + TimeToLiveInMin int `valid:"required"` + ExpireSyncPeriodInMin int `valid:"required"` +} + +type AuditEventSetting struct { + Event string + Name string +} + type UIDesign struct { Name string `schema:"Название стенда"` PrimaryColor string `schema:"Цвет в HEX, примеры: #ff4d4f #fa8c16 #a0d911 #1890ff #722ed1 #d4b106 #e91e63 #ff5722 #795548 #abb8c3 #525252 #689f38"`