mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-14 02:03:55 -04:00
Minz: New environment variable to control development mode (#2508)
* New environment variable to control development mode Suggestion of new enviromnent variable, as discussed https://github.com/FreshRSS/FreshRSS/pull/2492#issuecomment-523613920 * Update Docker/README.md Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com> * Update Docker/README.md Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com> * Update Docker/README.md Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com> * Declare ENV in Dockerfile Tested
This commit is contained in:
committed by
GitHub
parent
48dda9a803
commit
6cedeeeae5
@@ -49,6 +49,8 @@ RUN sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" /etc/apache2/apache2.co
|
||||
|
||||
ENV COPY_SYSLOG_TO_STDERR On
|
||||
ENV CRON_MIN ''
|
||||
ENV FRESHRSS_ENV ''
|
||||
|
||||
ENTRYPOINT ["./Docker/entrypoint.sh"]
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
@@ -45,6 +45,8 @@ RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \
|
||||
|
||||
ENV COPY_SYSLOG_TO_STDERR On
|
||||
ENV CRON_MIN ''
|
||||
ENV FRESHRSS_ENV ''
|
||||
|
||||
ENTRYPOINT ["./Docker/entrypoint.sh"]
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
@@ -61,6 +61,8 @@ RUN rm /usr/bin/qemu-* /var/www/FreshRSS/Docker/qemu-*
|
||||
|
||||
ENV COPY_SYSLOG_TO_STDERR On
|
||||
ENV CRON_MIN ''
|
||||
ENV FRESHRSS_ENV ''
|
||||
|
||||
ENTRYPOINT ["./Docker/entrypoint.sh"]
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
@@ -238,6 +238,22 @@ docker run -d --restart unless-stopped --log-opt max-size=10m \
|
||||
crond -f -d 6
|
||||
```
|
||||
|
||||
## Development mode
|
||||
|
||||
To contribute to FreshRSS development, you can use one of the Docker images to run and serve the PHP code,
|
||||
while reading the source code from your local (git) directory, like the following example:
|
||||
|
||||
```sh
|
||||
cd /path-to-local/FreshRSS/
|
||||
docker run --rm -p 8080:80 -e TZ=Europe/Paris -e FRESHRSS_ENV=development \
|
||||
-v $(pwd):/var/www/FreshRSS \
|
||||
freshrss/freshrss:dev
|
||||
```
|
||||
|
||||
This will start a server on port 8080, based on your local PHP code, which will show the logs directly in your terminal.
|
||||
Press <kbd>Control</kbd>+<kbd>c</kbd> to exit.
|
||||
|
||||
The `FRESHRSS_ENV=development` environment variable increases the level of logging and ensures that errors are displayed.
|
||||
|
||||
## More deployment options
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ function initTranslate() {
|
||||
}
|
||||
|
||||
function get_best_language() {
|
||||
$accept = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
$accept = empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? '' : $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
return strtolower(substr($accept, 0, 2));
|
||||
}
|
||||
|
||||
|
||||
@@ -115,21 +115,26 @@ class Minz_FrontController {
|
||||
}
|
||||
|
||||
private function setReporting() {
|
||||
$conf = Minz_Configuration::get('system');
|
||||
switch($conf->environment) {
|
||||
case 'production':
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'Off');
|
||||
ini_set('log_errors', 'On');
|
||||
break;
|
||||
case 'development':
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'On');
|
||||
ini_set('log_errors', 'On');
|
||||
break;
|
||||
case 'silent':
|
||||
error_reporting(0);
|
||||
break;
|
||||
$envType = getenv('FRESHRSS_ENV');
|
||||
if ($envType == '') {
|
||||
$conf = Minz_Configuration::get('system');
|
||||
$envType = $conf->environment;
|
||||
}
|
||||
switch ($envType) {
|
||||
case 'development':
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'On');
|
||||
ini_set('log_errors', 'On');
|
||||
break;
|
||||
case 'silent':
|
||||
error_reporting(0);
|
||||
break;
|
||||
case 'production':
|
||||
default:
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'Off');
|
||||
ini_set('log_errors', 'On');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user