summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2021-02-10 15:50:24 +0100
committerBenjamin Brahmer <info@b-brahmer.de>2021-02-10 16:12:41 +0100
commit4effa5fd8f8a718273fdcd16c8b9a6928044255c (patch)
tree33aeb0a0d9c86db12861fe81cedde2e47e9f63a3
parentb48bb5b347deca02239352a07edb21cde3299544 (diff)
improve file_from_env script
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rwxr-xr-xbin/tools/file_from_env.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/tools/file_from_env.php b/bin/tools/file_from_env.php
index e63cda1c4..e0d7c75f2 100755
--- a/bin/tools/file_from_env.php
+++ b/bin/tools/file_from_env.php
@@ -13,12 +13,17 @@
if ($argc < 2) {
echo "This script expects two parameters:\n";
echo "./file_from_env.php ENV_VAR PATH_TO_FILE\n";
- exit;
+ exit(1);
}
# Read environment variable
$content = getenv($argv[1]);
+if (!$content){
+ echo "Variable was empty\n";
+ exit(1);
+}
+
file_put_contents($argv[2], $content);
echo "Done...\n"; \ No newline at end of file