-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0fc1f1
commit 686d426
Showing
3 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/** | ||
* Nextcloud - News | ||
* | ||
* This file is licensed under the Affero General Public License version 3 or | ||
* later. See the COPYING file. | ||
* | ||
* @author Benjamin Brahmer <[email protected]> | ||
* @copyright Benjamin Brahmer 2020 | ||
*/ | ||
|
||
if ($argc < 2) { | ||
echo "This script expects two parameters:\n"; | ||
echo "./file_from_env.php ENV_VAR PATH_TO_FILE\n"; | ||
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"; |