Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds sandbox env to backup util #14

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/install_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var installAwsCmd = &cobra.Command{
Short: "Install AWS-CLI",
Long: `This command will curl the necessary aws-cli package and install it`,
Run: func(cmd *cobra.Command, args []string) {
if slices.Contains([]string{environments.DEVELOPMENT, environments.PREVIEW, environments.STAGING, environments.PRODUCTION}, os.Getenv("ENV")) {
if slices.Contains([]string{environments.SANDBOX, environments.DEVELOPMENT, environments.PREVIEW, environments.STAGING, environments.PRODUCTION}, os.Getenv("ENV")) {
InstallAWS()
} else {
logging.Logger.Printf("ENV set to LOCAL or TESTING, aws-cli is not necessary to install.")
Expand Down
2 changes: 2 additions & 0 deletions cmd/s3_to_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ var S3toDBCmd = &cobra.Command{
bucket_to_local_tables(db_creds, bucket_creds, path_struct)
os.Remove("pg_dump_tables")
logging.Logger.Println("Finished Restore and cleaning residual files/folders.")
case environments.SANDBOX:
fallthrough
case environments.DEVELOPMENT:
fallthrough
case environments.PREVIEW:
Expand Down
4 changes: 4 additions & 0 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func runLocalOrRemote(funs structs.Choice) {
fallthrough
case environments.TESTING:
funs.Local()
case environments.SANDBOX:
fallthrough
case environments.DEVELOPMENT:
fallthrough
case environments.PREVIEW:
Expand Down Expand Up @@ -73,6 +75,8 @@ func getBucketCredentials(s3path *structs.S3Path) vcap.Credentials {
os.Exit(logging.COULD_NOT_FIND_CREDENTIALS)
}
return bucket_creds
case environments.SANDBOX:
fallthrough
case environments.DEVELOPMENT:
fallthrough
case environments.PREVIEW:
Expand Down
1 change: 1 addition & 0 deletions internal/environments/environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package environments
const LOCAL = "LOCAL"
const TESTING = "TESTING"

const SANDBOX = "SANDBOX"
const DEVELOPMENT = "DEVELOPMENT"
const PREVIEW = "PREVIEW"
const STAGING = "STAGING"
Expand Down
2 changes: 2 additions & 0 deletions internal/util/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ func SetPaths(env string) {
PGDUMP_path = "pg_dump"
PGRESTORE_path = "pg_restore"
PSQL_path = "psql"
case environments.SANDBOX:
fallthrough
case environments.DEVELOPMENT:
fallthrough
case environments.PREVIEW:
Expand Down
2 changes: 1 addition & 1 deletion internal/util/unset_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func UnsetProxy() {
if slices.Contains([]string{environments.DEVELOPMENT, environments.PREVIEW, environments.STAGING, environments.PRODUCTION}, os.Getenv("ENV")) {
if slices.Contains([]string{environments.SANDBOX, environments.DEVELOPMENT, environments.PREVIEW, environments.STAGING, environments.PRODUCTION}, os.Getenv("ENV")) {
if IsDebugLevel("DEBUG") {
logging.Logger.Println("Proxy:", os.Getenv("https_proxy"))
}
Expand Down