mirror of
https://github.com/wallabag/wallabag.git
synced 2025-06-27 16:36:00 +00:00
Load .env file
This commit is contained in:
parent
2db9ee2ba7
commit
ad84d2b13b
6 changed files with 80 additions and 15 deletions
34
.env
Normal file
34
.env
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
SECRET="ch4n63m31fy0uc4n"
|
||||||
|
LOCALE=en
|
||||||
|
|
||||||
|
SERVER_NAME="Your wallabag instance"
|
||||||
|
DOMAIN_NAME=http://127.0.0.1:8000
|
||||||
|
|
||||||
|
DATABASE_URL=sqlite:///%kernel.project_dir%/data/db/wallabag.sqlite?charset=utf8
|
||||||
|
#DATABASE_URL=mysql://root:wallaroot@mariadb:3306/wallabag?charset=utf8mb4
|
||||||
|
#DATABASE_URL=postgres://wallabag:wallapass@postgres:5432/wallabag?charset=utf8
|
||||||
|
DATABASE_TABLE_PREFIX=wallabag_
|
||||||
|
|
||||||
|
FOSUSER_REGISTRATION=false
|
||||||
|
FOSUSER_CONFIRMATION=true
|
||||||
|
|
||||||
|
FOS_OAUTH_SERVER_ACCESS_TOKEN_LIFETIME=3600
|
||||||
|
FOS_OAUTH_SERVER_REFRESH_TOKEN_LIFETIME=1209600
|
||||||
|
TWOFACTOR_SENDER=no-reply@wallabag.org
|
||||||
|
|
||||||
|
MAILER_DSN=smtp://127.0.0.1
|
||||||
|
FROM_EMAIL=wallabag@example.com
|
||||||
|
|
||||||
|
RABBITMQ_HOST=rabbitmq
|
||||||
|
RABBITMQ_PORT=5672
|
||||||
|
RABBITMQ_USER=guest
|
||||||
|
RABBITMQ_PASSWORD=guest
|
||||||
|
|
||||||
|
REDIS_SCHEME=tcp
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_PATH=
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
RABBITMQ_PREFETCH_COUNT=10
|
||||||
|
|
||||||
|
SENTRY_DSN=
|
39
bin/console
39
bin/console
|
@ -3,25 +3,40 @@
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
use Symfony\Component\ErrorHandler\Debug;
|
use Symfony\Component\ErrorHandler\Debug;
|
||||||
|
|
||||||
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
|
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
|
||||||
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
|
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
|
||||||
// for more information
|
}
|
||||||
//umask(0000);
|
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
require __DIR__.'/../vendor/autoload.php';
|
require dirname(__DIR__).'/vendor/autoload.php';
|
||||||
|
|
||||||
$input = new ArgvInput();
|
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
|
||||||
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev', true);
|
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
|
||||||
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption('--no-debug', true) && $env !== 'prod';
|
|
||||||
|
|
||||||
if ($debug) {
|
|
||||||
Debug::enable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$kernel = new AppKernel($env, $debug);
|
$input = new ArgvInput();
|
||||||
|
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
|
||||||
|
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($input->hasParameterOption('--no-debug', true)) {
|
||||||
|
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||||
|
|
||||||
|
if ($_SERVER['APP_DEBUG']) {
|
||||||
|
umask(0000);
|
||||||
|
|
||||||
|
if (class_exists(Debug::class)) {
|
||||||
|
Debug::enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$kernel = new AppKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
||||||
$application = new Application($kernel);
|
$application = new Application($kernel);
|
||||||
$application->run($input);
|
$application->run($input);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<php>
|
<php>
|
||||||
<ini name="error_reporting" value="-1"/>
|
<ini name="error_reporting" value="-1"/>
|
||||||
<server name="KERNEL_CLASS" value="AppKernel"/>
|
<server name="KERNEL_CLASS" value="AppKernel"/>
|
||||||
<server name="APP_ENV" value="test"/>
|
<server name="APP_ENV" value="test" force="true"/>
|
||||||
<server name="APP_DEBUG" value="0"/>
|
<server name="APP_DEBUG" value="0"/>
|
||||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
|
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
|
||||||
</php>
|
</php>
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
|
|
||||||
require __DIR__ . '/../vendor/autoload.php';
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
|
||||||
|
|
||||||
(new Filesystem())->remove(__DIR__ . '/../var/cache/test');
|
(new Filesystem())->remove(__DIR__ . '/../var/cache/test');
|
||||||
|
|
||||||
if (!isPartialRun()) {
|
if (!isPartialRun()) {
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
require __DIR__.'/../vendor/autoload.php';
|
require __DIR__.'/../vendor/autoload.php';
|
||||||
|
|
||||||
$kernel = new AppKernel('prod', false);
|
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = 'prod');
|
||||||
|
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
|
||||||
|
|
||||||
|
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
|
||||||
|
|
||||||
|
$kernel = new AppKernel($_SERVER['APP_ENV'], (bool )$_SERVER['APP_DEBUG']);
|
||||||
//$kernel = new AppCache($kernel);
|
//$kernel = new AppCache($kernel);
|
||||||
|
|
||||||
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
|
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
use Symfony\Component\ErrorHandler\Debug;
|
use Symfony\Component\ErrorHandler\Debug;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
@ -19,9 +20,15 @@ if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||||
}
|
}
|
||||||
|
|
||||||
require __DIR__.'/../vendor/autoload.php';
|
require __DIR__.'/../vendor/autoload.php';
|
||||||
|
|
||||||
|
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = 'dev');
|
||||||
|
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '1');
|
||||||
|
|
||||||
|
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
|
||||||
|
|
||||||
Debug::enable();
|
Debug::enable();
|
||||||
|
|
||||||
$kernel = new AppKernel('dev', true);
|
$kernel = new AppKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
||||||
$request = Request::createFromGlobals();
|
$request = Request::createFromGlobals();
|
||||||
$response = $kernel->handle($request);
|
$response = $kernel->handle($request);
|
||||||
$response->send();
|
$response->send();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue