Skip to content

Commit

Permalink
Hide audit logs behind beta flag (#897)
Browse files Browse the repository at this point in the history
* remove audit logs

* hide audit logs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix lint

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and neel-astro committed Nov 23, 2022
1 parent f782b70 commit b31e0a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/cloud/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"

"github.com/astronomer/astro-cli/cloud/organization"
"github.com/astronomer/astro-cli/config"
)

var (
Expand All @@ -35,8 +36,10 @@ func newOrganizationCmd(out io.Writer) *cobra.Command {
cmd.AddCommand(
newOrganizationListCmd(out),
newOrganizationSwitchCmd(out),
newOrganizationAuditLogs(out),
)
if config.CFG.AuditLogs.GetBool() {
cmd.AddCommand(newOrganizationAuditLogs(out))
}
return cmd
}

Expand Down
3 changes: 3 additions & 0 deletions cmd/cloud/organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"testing"

astro "github.com/astronomer/astro-cli/astro-client"
"github.com/astronomer/astro-cli/config"
testUtil "github.com/astronomer/astro-cli/pkg/testing"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -53,6 +54,8 @@ func TestOrganizationSwitch(t *testing.T) {
}

func TestOrganizationExportAuditLogs(t *testing.T) {
// turn on audit logs
config.CFG.AuditLogs.SetHomeString("true")
orgExportAuditLogs = func(client astro.Client, out io.Writer, orgName string, earliest int) error {
return nil
}
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ var (
Interactive: newCfg("interactive", "false"),
PageSize: newCfg("page_size", "20"),
SQLCLI: newCfg("beta.sql_cli", "false"),
AuditLogs: newCfg("beta.audit_logs", "false"),
}

// viperHome is the viper object in the users home directory
Expand Down
1 change: 1 addition & 0 deletions config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type cfgs struct {
Interactive cfg
PageSize cfg
SQLCLI cfg
AuditLogs cfg
}

// Creates a new cfg struct
Expand Down

0 comments on commit b31e0a6

Please sign in to comment.