From 95e4f8ff016be0ade1f619248a51656b84e7912b Mon Sep 17 00:00:00 2001 From: Christian A. Weber Date: Thu, 30 Jul 2026 16:11:00 +0200 Subject: allow storing credentials in .env in service home instead of source code by adding them to service::$var --- it.class | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'it.class') diff --git a/it.class b/it.class index c91a7fb..2141ad0 100644 --- a/it.class +++ b/it.class @@ -25,7 +25,6 @@ static $error_context; # Callback, can provide $p params like 'head' and 'toscre /** * Create config class with static members initialized (e.g. $home). - * NOTE: PHP5 ONLY * @param $p Static members to be generated in newly created class * service: Class name of created class (default: from caller path) * home: Home directory of application (default: from caller path) @@ -44,6 +43,10 @@ static function createconfig($p = array()) 'service' => $parts[2], ); + # We store credentials in a service's . "/.env" so they don't need to be in git + foreach (it::match('(\w+)\s*=\s*["\']?(.*?)["\']?$', @it::file_get_contents($GLOBALS['ULTRAHOME'] . "/.env"), ['multiline' => true, 'all' => true]) as $env) + $p += [$env[0] => $env[1]]; + if (class_exists($p['service'] . "_tools")) $extends = "extends {$p['service']}_tools "; -- cgit v1.2.3