Skip to content

Commit

Permalink
remove unnecessary env, editing gitgnore to it.
Browse files Browse the repository at this point in the history
change bootstrap to app/config
editing bin console tu news changes.
fix index.php to work with bootstrap in different folder.
change file responsible to get env test.
edit phpunit file with new env data
  • Loading branch information
lenonleite committed Apr 25, 2023
1 parent 9881df9 commit 3405647
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 52 deletions.
15 changes: 14 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# .env
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
APP_ENV=prod
APP_DEBUG=0
11 changes: 0 additions & 11 deletions .env.dist

This file was deleted.

11 changes: 0 additions & 11 deletions .env.test

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
!.ddev/commands/web/dd
.php_cs.cache
/.env.local
/.env.local.php
/.env.*.local
/composer.phar
/coverage.xml
Expand Down
1 change: 0 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
->in(__DIR__.'/app/middlewares')
->in(__DIR__.'/app/migrations')
->in(__DIR__.'/plugins')
->in(__DIR__.'/config')
->in(__DIR__.'/.github/workflows/mautic-asset-upload');

return (new PhpCsFixer\Config())
Expand Down
11 changes: 0 additions & 11 deletions app/assets/scaffold/files/.env.dist

This file was deleted.

1 change: 1 addition & 0 deletions app/assets/scaffold/files/example.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
!.ddev/commands/web/dd
.php_cs.cache
/.env.local
/.env.local.php
/.env.*.local
/composer.phar
/coverage.xml
Expand Down
5 changes: 1 addition & 4 deletions app/bundles/CoreBundle/Test/EnvLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ final class EnvLoader
*/
public static function load(): void
{
$root = __DIR__.'/../../../../';
$envFile = file_exists($root.'.env.test.local') ? $root.'.env.test.local' : $root.'.env.test';
$dotenv = new Dotenv();
$dotenv->load($envFile);
(new Dotenv())->loadEnv(__DIR__.'/../../../../.env');
}
}
7 changes: 1 addition & 6 deletions app/bundles/CoreBundle/Test/MauticMysqlTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,7 @@ private function wasRollbackSuccessful(): bool

private function getTablePrefix(): string
{
$prefix = self::$container->getParameter('mautic.db_table_prefix');
if (is_null($prefix)) {
return '';
}

return $prefix;
return (string) self::$container->getParameter('mautic.db_table_prefix');
}

private function isDatabasePrepared(): bool
Expand Down
3 changes: 1 addition & 2 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,10 @@
"extra": {
"mautic-scaffold": {
"file-mapping": {
"[project-root]/.env.dist": "assets/scaffold/files/.env.dist",
"[project-root]/Gruntfile.js": "assets/scaffold/files/Gruntfile.js",
"[project-root]/package.json": "assets/scaffold/files/package.json",
"[project-root]/package-lock.json": "assets/scaffold/files/package-lock.json",
"[project-root]/config/bootstrap.php": "assets/scaffold/files/bootstrap.php",
"[project-root]/app/config/bootstrap.php": "assets/scaffold/files/bootstrap.php",
"[project-root]/bin/console": "assets/scaffold/files/console",
"[project-root]/bin/.htaccess": "assets/scaffold/files/deny.htaccess",
"[project-root]/.gitignore": "assets/scaffold/files/example.gitignore",
Expand Down
6 changes: 3 additions & 3 deletions config/bootstrap.php → app/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__).'/autoload.php';
require dirname(__DIR__).'/../autoload.php';

if (!class_exists(Dotenv::class)) {
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}

// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
if (is_array($env = @include dirname(__DIR__).'/../.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
(new Dotenv(false))->populate($env);
} else {
// load all the .env files
(new Dotenv())->loadEnv(dirname(__DIR__).'/.env', null, 'prod');
(new Dotenv())->loadEnv(dirname(__DIR__).'/../.env', null, 'prod');
}

$_SERVER += $_ENV;
Expand Down
1 change: 1 addition & 0 deletions app/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<const name="MAUTIC_ENV" value="test"/>
<server name="KERNEL_DIR" value="app"/>
<server name="APP_DEBUG" value="0"/>
<server name="APP_ENV" value="test" force="true" />
<ini name="error_reporting" value="E_ALL" />
</php>
<listeners>
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

require dirname(__DIR__).'/config/bootstrap.php';
require dirname(__DIR__).'/app/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Fix for hosts that do not have date.timezone set, it will be reset based on users settings
date_default_timezone_set('UTC');

require 'config/bootstrap.php';
require 'app/config/bootstrap.php';

use Mautic\CoreBundle\ErrorHandler\ErrorHandler;
use Mautic\Middleware\MiddlewareBuilder;
Expand Down

0 comments on commit 3405647

Please # to comment.