3
0

Add env options to enable/disable Compose record action log

It will enable/disable action log entry for compose record create, update or delete.
This commit is contained in:
Vivek Patel
2022-04-25 19:55:36 +05:30
committed by Denis Arh
parent 0954c0d638
commit e7a36e26c5
5 changed files with 45 additions and 2 deletions
+13
View File
@@ -346,6 +346,19 @@
# Default: <no value>
# ACTIONLOG_WORKFLOW_FUNCTIONS_ENABLED=<no value>
###############################################################################
# Enables actionlog for compose record create, update, and delete. which is disabled by default.
#
# [IMPORTANT]
# ====
# This is temp fix for now, it will be removed completely in future release.
# Once new env var will be introduced for actionlog policy, which will enable more control over action log policies.
# ====
#
# Type: bool
# Default: <no value>
# ACTIONLOG_COMPOSE_RECORD_ENABLED=<no value>
###############################################################################
###############################################################################
# API Gateway
+14
View File
@@ -18,6 +18,20 @@ actionLog: schema.#optionsGroup & {
workflow_functions_enabled: {
type: "bool"
}
compose_record_enabled: {
type: "bool"
defaultGoExpr: "false"
description: """
Enables actionlog for compose record create, update, and delete. which is disabled by default.
[IMPORTANT]
====
This is temp fix for now, it will be removed completely in future release.
Once new env var will be introduced for actionlog policy, which will enable more control over action log policies.
====
"""
}
}
title: "Actionlog"
}
+2 -1
View File
@@ -474,8 +474,9 @@ func (svc record) Bulk(ctx context.Context, oo ...*types.RecordBulkOperation) (r
continue
}
_ = svc.recordAction(ctx, aProp, action, err)
if err != nil {
return svc.recordAction(ctx, aProp, action, err)
return err
}
rr = append(rr, r)
+13
View File
@@ -111,6 +111,19 @@ func Initialize(ctx context.Context, log *zap.Logger, s store.Storer, c Config)
tee = logger.MakeDebugLogger()
}
// Record log policy update
if !c.ActionLog.ComposeRecordEnabled {
policy = actionlog.NewPolicyAll(
policy,
actionlog.NewPolicyAll(
actionlog.NewPolicyMatchResource("compose:record"),
actionlog.NewPolicyMatchAction("create", "update", "delete"),
actionlog.NewPolicyMatchSeverity(actionlog.Emergency),
),
)
}
DefaultActionlog = actionlog.NewService(DefaultStore, log, tee, policy)
}
+3 -1
View File
@@ -79,6 +79,7 @@ type (
Enabled bool `env:"ACTIONLOG_ENABLED"`
Debug bool `env:"ACTIONLOG_DEBUG"`
WorkflowFunctionsEnabled bool `env:"ACTIONLOG_WORKFLOW_FUNCTIONS_ENABLED"`
ComposeRecordEnabled bool `env:"ACTIONLOG_COMPOSE_RECORD_ENABLED"`
}
ApigwOpt struct {
@@ -452,7 +453,8 @@ func SMTP() (o *SMTPOpt) {
// This function is auto-generated
func ActionLog() (o *ActionLogOpt) {
o = &ActionLogOpt{
Enabled: true,
Enabled: true,
ComposeRecordEnabled: false,
}
// Custom defaults