Minor refactoring for 2.1.2
This commit is contained in:
parent
afba893623
commit
c3e43617e4
6 changed files with 37 additions and 23 deletions
|
@ -1,5 +1,9 @@
|
|||
# CHANGELOG
|
||||
|
||||
## 2.1.2 - 2019/08/07
|
||||
* Minor refactoring
|
||||
* Update documentation
|
||||
|
||||
## 2.1.1 - 2019/08/07
|
||||
* Updated translation
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@ you're using docker as deployment type.
|
|||
* Logs are saved in `/var/www/html/application/log` for docker containers. You should create a volume
|
||||
for this location if you're using docker as deployment type.
|
||||
|
||||
**Important**: Ensure that host binds have permissions set up properly. The user which is used in the docker container is `www-data` with
|
||||
id `82`. If, e.g. logs are host bound, then execute `chown -R 82:82 host/path/to/log`. The same holds true for snapshots.
|
||||
**Important**: Ensure that host binds have permissions set up properly. The user which is used in the docker container
|
||||
is `www-data` with id `82`. If, e.g. logs are host bound, then execute `chown -R 82:82 host/path/to/log`.
|
||||
The same holds true for snapshots.
|
||||
|
||||
### Usage with docker-compose
|
||||
The recommended way is to use docker-compose. The `network_mode = "host"` is required in order to show correct IP
|
||||
|
|
|
@ -64,4 +64,21 @@ class EnvConstants
|
|||
* Log level
|
||||
*/
|
||||
const LOG_LEVEL = "log_level";
|
||||
|
||||
/**
|
||||
* Required attributes
|
||||
*/
|
||||
const ENV_REQUIRED = [
|
||||
EnvConstants::SITE_TITLE,
|
||||
EnvConstants::SITE_LANGUAGE,
|
||||
EnvConstants::SITE_DATE_FORMAT,
|
||||
EnvConstants::THEME,
|
||||
EnvConstants::THEME_CACHE,
|
||||
EnvConstants::TEAMSPEAK_HOST,
|
||||
EnvConstants::TEAMSPEAK_QUERY_PORT,
|
||||
EnvConstants::TEAMSPEAK_USER,
|
||||
EnvConstants::TEAMSPEAK_LOG_LINES,
|
||||
EnvConstants::LOG_NAME,
|
||||
EnvConstants::LOG_LEVEL
|
||||
];
|
||||
}
|
|
@ -7,6 +7,9 @@ RUN apk add --no-cache git \
|
|||
# adjust nginx
|
||||
COPY docker/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY docker/nginx.conf /etc/nginx/nginx.conf
|
||||
RUN sed -i "s|upload_max_filesize = 2M|upload_max_filesize = 1024M|g" /etc/php/7.3/php.ini \
|
||||
&& sed -i "s|post_max_size = 8M|post_max_size = 1024M|g" /etc/php/7.3/php.ini \
|
||||
&& sed -i "s|max_execution_time = 30|max_execution_time = 86400|g" /etc/php/7.3/php.ini
|
||||
|
||||
# copy application and set permissions
|
||||
COPY config/ /var/www/html/application/config/
|
||||
|
@ -16,10 +19,6 @@ COPY src/ /var/www/html/application/src/
|
|||
COPY composer.json /var/www/html/application/composer.json
|
||||
RUN mkdir -p /var/www/html/application/bin/ \
|
||||
&& mkdir -p /var/www/html/application/cache/ \
|
||||
&& chmod -R 777 /var/www/html/application/data/ \
|
||||
&& mkdir -p /var/www/html/application/log/ \
|
||||
&& touch /var/www/html/application/log/application.log \
|
||||
&& chmod 777 /var/www/html/application/log/application.log \
|
||||
&& chown -R www-data:www-data /var/www/html/application
|
||||
|
||||
# initialize app
|
||||
|
|
|
@ -215,7 +215,7 @@ $container['notFoundHandler'] = function ($container) {
|
|||
$container['errorHandler'] = function ($container) {
|
||||
return function (Request $request, Response $response, $exception) use ($container) {
|
||||
|
||||
// handle all teamspeak exceptions with a flash message
|
||||
// handle all TeamSpeak exceptions with a flash message
|
||||
if ($exception instanceof TSException) {
|
||||
$container->flash->addMessage('error', $exception->getMessage());
|
||||
|
||||
|
@ -230,9 +230,7 @@ $container['errorHandler'] = function ($container) {
|
|||
'content' => $exception->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
// all others are 500
|
||||
else {
|
||||
} else {
|
||||
$container['logger']->error($container['translator']->trans('log.internal.application.error'), [
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Dotenv\Dotenv;
|
||||
use Dotenv\Exception\ValidationException;
|
||||
use Monolog\Handler\ErrorLogHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Logger;
|
||||
|
@ -27,19 +28,13 @@ class BootstrapHelper
|
|||
if (file_exists($envFile)) {
|
||||
$env = new Dotenv(realpath($envPath), EnvConstants::ENV_FILE);
|
||||
$res = $env->load();
|
||||
$env->required([
|
||||
EnvConstants::SITE_TITLE,
|
||||
EnvConstants::SITE_LANGUAGE,
|
||||
EnvConstants::SITE_DATE_FORMAT,
|
||||
EnvConstants::THEME,
|
||||
EnvConstants::THEME_CACHE,
|
||||
EnvConstants::TEAMSPEAK_HOST,
|
||||
EnvConstants::TEAMSPEAK_QUERY_PORT,
|
||||
EnvConstants::TEAMSPEAK_USER,
|
||||
EnvConstants::TEAMSPEAK_LOG_LINES,
|
||||
EnvConstants::LOG_NAME,
|
||||
EnvConstants::LOG_LEVEL
|
||||
]);
|
||||
|
||||
try {
|
||||
$env->required(EnvConstants::ENV_REQUIRED);
|
||||
} catch (ValidationException $e) {
|
||||
die($e->getMessage());
|
||||
}
|
||||
|
||||
return $res;
|
||||
} else {
|
||||
die('No environment file found in ' . realpath($envFile));
|
||||
|
|
Reference in a new issue