summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorChristian A. Weber2026-07-30 16:11:00 +0200
committerChristian A. Weber2026-07-30 16:13:32 +0200
commit95e4f8ff016be0ade1f619248a51656b84e7912b (patch)
treeedcde23a4f765e9724143cf3ee8375e649d65e5a /it.class
parent9da0ebc85c2c64735acb728fda1e04f30b63c229 (diff)
downloaditools-95e4f8ff016be0ade1f619248a51656b84e7912b.tar.gz
itools-95e4f8ff016be0ade1f619248a51656b84e7912b.tar.bz2
itools-95e4f8ff016be0ade1f619248a51656b84e7912b.zip
allow storing credentials in .env in service home instead of source code by adding them to service::$var
Diffstat (limited to 'it.class')
-rw-r--r--it.class5
1 files changed, 4 insertions, 1 deletions
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 ";