mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-25 14:05:03 +00:00
.github
.husky
backend
cli
config
detect
docker
packages
api
cmd
cmd_test.go
export.go
init.go
login.go
man.go
reset.go
root.go
run.go
scan.go
secrets.go
user.go
vault.go
config
crypto
models
srp
telemetry
util
visualize
report
scripts
testdata
.gitignore
.infisicalignore
go.mod
go.sum
goreleaser.dockerfile
infisical-cli.repo
main.go
upload_to_cloudsmith.sh
cloudformation
docs
frontend
helm-charts
img
k8-operator
nginx
.env.example
.eslintignore
.gitignore
.goreleaser.yaml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile.standalone-infisical
LICENSE
Makefile
README.md
SECURITY.md
docker-compose.dev.yml
docker-compose.yml
ecosystem.config.js
package-lock.json
package.json
render.yaml
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
/*
|
|
Copyright (c) 2023 Infisical Inc.
|
|
*/
|
|
package cmd
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/Infisical/infisical-merge/packages/util"
|
|
"github.com/posthog/posthog-go"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var resetCmd = &cobra.Command{
|
|
Use: "reset",
|
|
Short: "Used to delete all Infisical related data on your machine",
|
|
DisableFlagsInUseLine: true,
|
|
Example: "infisical reset",
|
|
Args: cobra.NoArgs,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
// delete config
|
|
_, pathToDir, err := util.GetFullConfigFilePath()
|
|
if err != nil {
|
|
util.HandleError(err)
|
|
}
|
|
|
|
os.RemoveAll(pathToDir)
|
|
|
|
// delete keyring
|
|
keyringInstance, err := util.GetKeyRing()
|
|
if err != nil {
|
|
util.HandleError(err)
|
|
}
|
|
|
|
keyringInstance.Remove(util.KEYRING_SERVICE_NAME)
|
|
|
|
// delete secrets backup
|
|
util.DeleteBackupSecrets()
|
|
|
|
util.PrintSuccessMessage("Reset successful")
|
|
Telemetry.CaptureEvent("cli-command:reset", posthog.NewProperties().Set("version", util.CLI_VERSION))
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(resetCmd)
|
|
}
|