Last active
July 14, 2019 07:33
Revisions
-
CMCDragonkai revised this gist
Nov 21, 2013 . 1 changed file with 1 addition and 1 deletion.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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ <?php /** * Loads secrets into the application. Setup secrets via $secrets[], get secrets via $_ENV['secrets'][] */ class Secrets{ -
CMCDragonkai created this gist
Nov 21, 2013 .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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ <?php /** * Loads secrets into the application. If no secrets are loaded, it will close the application and announce this. */ class Secrets{ public static function load(){ $secrets_path = __DIR__ . '/secrets'; $secrets_loaded = false; //see if "secrets folder" exists if(file_exists($secrets_path) AND is_dir($secrets_path)){ foreach(new DirectoryIterator($secrets_path) as $file){ //ignore dots and non-php extensions and this file itself if($file->isDot() OR $file->getExtension() != 'php') continue; $secrets_loaded = true; include_once($file->getPathname()); } } if($secrets_loaded){ foreach($secrets as $key => $value){ $_ENV['secrets'][$key] = $value; } unset($secrets); } } }