Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace getenv() with env() #1121

Merged
merged 1 commit into from
Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions app/sprinkles/core/config/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
'address_book' => [
'admin' => [
'email' => getenv('SMTP_USER') ?: null,
'email' => env('SMTP_USER'),
'name' => 'Site Administrator',
],
],
Expand Down Expand Up @@ -97,7 +97,7 @@
* Note : CSRF Middleware should only be disabled for dev or debug purposes.
*/
'csrf' => [
'enabled' => (getenv('CSRF_ENABLED') !== false) ? getenv('CSRF_ENABLED') : true,
'enabled' => env('CSRF_ENABLED', true),
'name' => 'csrf',
'storage_limit' => 200,
'strength' => 16,
Expand All @@ -124,12 +124,12 @@
*/
'db' => [
'default' => [
'driver' => getenv('DB_DRIVER') ?: 'mysql',
'host' => getenv('DB_HOST') ?: 'localhost',
'port' => getenv('DB_PORT') ?: null,
'database' => getenv('DB_NAME') ?: null,
'username' => getenv('DB_USER') ?: null,
'password' => getenv('DB_PASSWORD') ?: null,
'driver' => env('DB_DRIVER', 'mysql'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT'),
'database' => env('DB_NAME'),
'username' => env('DB_USER'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
Expand Down Expand Up @@ -160,8 +160,8 @@
* Supported Drivers for disk: "local", "ftp", "sftp", "s3", "rackspace"
*/
'filesystems' => [
'default' => getenv('FILESYSTEM_DRIVER') ?: 'local',
'cloud' => getenv('FILESYSTEM_CLOUD') ?: 's3',
'default' => env('FILESYSTEM_DRIVER', 'local'),
'cloud' => env('FILESYSTEM_CLOUD', 's3'),

'disks' => [
/*
Expand Down Expand Up @@ -196,11 +196,11 @@
*/
's3' => [
'driver' => 's3',
'key' => getenv('AWS_ACCESS_KEY_ID') ?: '',
'secret' => getenv('AWS_SECRET_ACCESS_KEY') ?: '',
'region' => getenv('AWS_DEFAULT_REGION') ?: '', // See : http://docs.aws.amazon.com/general/latest/gr/rande.html
'bucket' => getenv('AWS_BUCKET') ?: '',
'url' => getenv('AWS_URL') ?: '',
'key' => env('AWS_ACCESS_KEY_ID', ''),
'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
'region' => env('AWS_DEFAULT_REGION', ''), // See : http://docs.aws.amazon.com/general/latest/gr/rande.html
'bucket' => env('AWS_BUCKET', ''),
'url' => env('AWS_URL', ''),
],
/*
* Rackspace Config. Config should go in .env file. see :
Expand All @@ -213,12 +213,12 @@
*/
'rackspace' => [
'driver' => 'rackspace',
'username' => getenv('RACKSPACE_USERNAME') ?: '',
'key' => getenv('RACKSPACE_KEY') ?: '',
'container' => getenv('RACKSPACE_CONTAINER') ?: '',
'endpoint' => getenv('RACKSPACE_ENDPOINT') ?: '',
'region' => getenv('RACKSPACE_REGION') ?: '',
'url_type' => getenv('RACKSPACE_URL_TYPE') ?: '',
'username' => env('RACKSPACE_USERNAME', ''),
'key' => env('RACKSPACE_KEY', ''),
'container' => env('RACKSPACE_CONTAINER', ''),
'endpoint' => env('RACKSPACE_ENDPOINT', ''),
'region' => env('RACKSPACE_REGION', ''),
'url_type' => env('RACKSPACE_URL_TYPE', ''),
],
],
],
Expand All @@ -231,12 +231,12 @@
*/
'mail' => [
'mailer' => 'smtp', // Set to one of 'smtp', 'mail', 'qmail', 'sendmail'
'host' => getenv('SMTP_HOST') ?: null,
'host' => env('SMTP_HOST'),
'port' => 587,
'auth' => true,
'secure' => 'tls', // Enable TLS encryption. Set to `tls`, `ssl` or `false` (to disabled)
'username' => getenv('SMTP_USER') ?: null,
'password' => getenv('SMTP_PASSWORD') ?: null,
'username' => env('SMTP_USER'),
'password' => env('SMTP_PASSWORD'),
'smtp_debug' => 4,
'message_options' => [
'CharSet' => 'UTF-8',
Expand Down
4 changes: 2 additions & 2 deletions app/sprinkles/core/config/testing.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
* Disable native sessions in tests
*/
'session' => [
'handler' => getenv('TEST_SESSION_HANDLER') ?: 'array',
'handler' => env('TEST_SESSION_HANDLER', 'array'),
],
/*
* Database to use when using the TestDatabase Trait
*/
'testing' => [
'dbConnection' => getenv('TEST_DB') ?: 'test_integration',
'dbConnection' => env('TEST_DB', 'test_integration'),
],
];
4 changes: 2 additions & 2 deletions app/sprinkles/core/src/Bakery/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ protected function execute(InputInterface $input, OutputInterface $output)

// Perform tasks & display info
$this->io->definitionList(
['UserFrosing version' => \UserFrosting\VERSION],
lcharette marked this conversation as resolved.
Show resolved Hide resolved
['UserFrosting version' => \UserFrosting\VERSION],
['OS Name' => php_uname('s')],
['Project Root' => \UserFrosting\ROOT_DIR],
['Environment mode' => getenv('UF_MODE')],
['Environment mode' => env('UF_MODE', 'default')],
['PHP Version' => $this->checkPhpVersion()],
['Node Version' => $this->checkNodeVersion()],
['NPM Version' => $this->checkNpmVersion()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function register(ContainerInterface $container)
}

// Get configuration mode from environment
$mode = getenv('UF_MODE') ?: '';
$mode = env('UF_MODE', '');

// Construct and load config repository
$builder = new ConfigPathBuilder($c->locator, 'config://');
Expand Down
4 changes: 2 additions & 2 deletions app/sprinkles/core/src/Util/CheckEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public function checkPhp()
*/
public function isProduction()
{
return getenv('UF_MODE') == 'production';
return env('UF_MODE') == 'production';
}

/**
Expand All @@ -392,6 +392,6 @@ public function isProduction()
*/
public function skipPermissionsCheck()
{
return getenv('SKIP_PERMISSION_CHECK') ? true : false;
return env('SKIP_PERMISSION_CHECK', false);
}
}
2 changes: 1 addition & 1 deletion app/system/Bakery/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function isProduction(): bool
{
// Need to touch the config service first to load dotenv values
$config = $this->ci->config;
$mode = getenv('UF_MODE') ?: '';
$mode = env('UF_MODE', '');

return $mode === 'production';
}
Expand Down