diff options
| author | Christian A. Weber | 2026-07-30 16:11:00 +0200 |
|---|---|---|
| committer | Christian A. Weber | 2026-07-30 16:13:32 +0200 |
| commit | 95e4f8ff016be0ade1f619248a51656b84e7912b (patch) | |
| tree | edcde23a4f765e9724143cf3ee8375e649d65e5a /it.class | |
| parent | 9da0ebc85c2c64735acb728fda1e04f30b63c229 (diff) | |
| download | itools-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.class | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 "; |