Added gh_set_env_not_exists

This commit is contained in:
Varun 2020-10-22 07:05:28 +05:30
parent 9da388dd1a
commit a8b3fe20a8
No known key found for this signature in database
GPG key ID: 93FB46DCF16E0D6F

View file

@ -34,9 +34,19 @@ function gh_set_env( $key, $value, $silent = false ) {
if ( ! $silent ) {
gh_log( "✔️ ENV : ${key} => ${value}" );
}
}
function gh_set_env_silent( $key, $value ) {
gh_set_env( $key, $value, true );
}
function gh_set_env_not_exists( $key, $value, $silent = false ) {
if ( ! isset( $_ENV[ $key ] ) ) {
gh_set_env( $key, $value, $silent );
return true;
}
if ( ! $silent ) {
gh_log( " ENV ${key} ALREADY EXISTS WITH VALUE - {$_ENV[$key]}" );
}
return false;
}