From 6e91cde113aee78e4b225594ebe5d8cf01b43a5e Mon Sep 17 00:00:00 2001 From: Joe Dixon Date: Wed, 23 Nov 2022 15:18:31 +0000 Subject: [PATCH] Add secrets warning to CLI output (#205) --- src/BuildProcess/CollectSecrets.php | 4 ++++ src/Commands/SecretCommand.php | 2 ++ src/Commands/SecretListCommand.php | 2 ++ src/Commands/SecretPassportCommand.php | 2 ++ 4 files changed, 10 insertions(+) diff --git a/src/BuildProcess/CollectSecrets.php b/src/BuildProcess/CollectSecrets.php index 58b63f12..f87f9843 100644 --- a/src/BuildProcess/CollectSecrets.php +++ b/src/BuildProcess/CollectSecrets.php @@ -26,6 +26,10 @@ public function __invoke() return [$secret['name'] => $secret['version']]; })->toArray(); + if (! empty($secrets)) { + Helpers::warn('Using secrets may result in unexpected increased AWS billing charges. Instead, we recommend you utilize environment variables and / or encrypted environment files.'); + } + $this->files->put( $this->appPath.'/vaporSecrets.php', 'vapor->storeSecret( Manifest::id(), $this->argument('environment'), diff --git a/src/Commands/SecretListCommand.php b/src/Commands/SecretListCommand.php index cd55446b..52448eaf 100644 --- a/src/Commands/SecretListCommand.php +++ b/src/Commands/SecretListCommand.php @@ -30,6 +30,8 @@ public function handle() { Helpers::ensure_api_token_is_available(); + Helpers::warn('Using secrets may result in unexpected increased AWS billing charges. Instead, we recommend you utilize environment variables and / or encrypted environment files.'); + $secrets = $this->vapor->secrets( Manifest::id(), $this->argument('environment') diff --git a/src/Commands/SecretPassportCommand.php b/src/Commands/SecretPassportCommand.php index 41a7962f..d6242a52 100644 --- a/src/Commands/SecretPassportCommand.php +++ b/src/Commands/SecretPassportCommand.php @@ -30,6 +30,8 @@ public function handle() { Helpers::ensure_api_token_is_available(); + Helpers::warn('Using secrets may result in unexpected increased AWS billing charges. Instead, we recommend you utilize environment variables and / or encrypted environment files.'); + if (! file_exists(getcwd().'/storage/oauth-private.key') || ! file_exists(getcwd().'/storage/oauth-public.key')) { Helpers::abort('Unable to find Passport keys in [storage] directory.');