Removed unneeded configurable variables.

This commit is contained in:
Abdulmhsen B. A. A
2022-06-20 19:32:36 +03:00
parent 7d471af2e1
commit c3802bed14
5 changed files with 26 additions and 66 deletions

7
FAQ.md
View File

@@ -309,9 +309,9 @@ it's slower than `MemoryMapper`.
### Q: What environment variables supported?
| Key | Type | Description | Default |
|-----------------------|--------|---------------------------------------------------------------------------------|------------------------------------|
| WS_DATA_PATH | string | Where key data stored (config, db). | `${BASE_PATH}/var` |
| WS_TMP_DIR | string | Where temp data stored. (logs, cache). | `${WS_DATA_PATH}` |
|-----------------------|--------|---------------------------------------------------------------------------------|-------------------------------|
| WS_DATA_PATH | string | Where to store main data. (config, db). | `${BASE_PATH}/var` |
| WS_TMP_DIR | string | Where to store temp data. (logs, cache) | `${WS_DATA_PATH}` |
| WS_TZ | string | Set timezone. | `UTC` |
| WS_CRON_IMPORT | bool | Enable import scheduled task. Value casted to bool. | `false` |
| WS_CRON_IMPORT_AT | string | When to run import scheduled task. Valid Cron Expression Expected. | `0 */1 * * *` (Every 1h) |
@@ -325,7 +325,6 @@ it's slower than `MemoryMapper`.
| WS_LOGS_PRUNE_AFTER | string | Delete logs older than specified time. Set to `disable` to disable the pruning. | `-3 DAYS` |
| WS_LOGS_CONTEXT | bool | Add context to console output messages. | `false` |
| WS_LOGGER_FILE_ENABLE | bool | Save logs to file. | `true` |
| WS_LOGGER_FILE | string | Full path to log file. | `${WS_TMP_DIR}/logs/app.(Ymd).log` |
| WS_LOGGER_FILE_LEVEL | string | File Logger Level. | `ERROR` |
| WS_WEBHOOK_DEBUG | bool | If enabled, allow dumping request/webhook using `rdump` & `wdump` parameters. | `false` |

View File

@@ -34,7 +34,7 @@ return (function () {
],
];
$config['logs']['affix'] = makeDate()->format('Ymd');
$logDateFormat = makeDate()->format('Ymd');
$config['tmpDir'] = fixPath(env('WS_TMP_DIR', ag($config, 'path')));
@@ -55,8 +55,9 @@ return (function () {
];
$config['webhook'] = [
'logfile' => ag($config, 'tmpDir') . '/logs/access.' . $logDateFormat . '.log',
'debug' => (bool)env('WS_WEBHOOK_DEBUG', false),
'tokenLength' => (int)env('WS_WEBHOOK_TOKEN_LENGTH', 16),
'tokenLength' => 16,
];
$config['mapper'] = [
@@ -83,7 +84,6 @@ return (function () {
];
$config['debug'] = [
'import' => (bool)env('WS_DEBUG_IMPORT', false),
'profiler' => [
'options' => [
'save.handler' => 'file',
@@ -106,10 +106,7 @@ return (function () {
'type' => 'stream',
'enabled' => (bool)env('WS_LOGGER_FILE_ENABLE', true),
'level' => env('WS_LOGGER_FILE_LEVEL', Logger::ERROR),
'filename' => env(
'WS_LOGGER_FILE',
fn() => ag($config, 'tmpDir') . '/logs/app.' . ag($config, 'logs.affix') . '.log'
),
'filename' => ag($config, 'tmpDir') . '/logs/log.' . $logDateFormat . '.log',
],
'stderr' => [
'type' => 'stream',
@@ -129,7 +126,7 @@ return (function () {
'facility' => env('WS_LOGGER_SYSLOG_FACILITY', LOG_USER),
'enabled' => (bool)env('WS_LOGGER_SYSLOG_ENABLED', !env('IN_DOCKER')),
'level' => env('WS_LOGGER_SYSLOG_LEVEL', Logger::ERROR),
'name' => env('WS_LOGGER_SYSLOG_NAME', ag($config, 'name')),
'name' => ag($config, 'name'),
],
];
@@ -177,7 +174,7 @@ return (function () {
];
$config['tasks'] = [
'logfile' => ag($config, 'tmpDir') . '/logs/tasks/task.' . ag($config, 'logs.affix') . '.log',
'logfile' => ag($config, 'tmpDir') . '/logs/task.' . $logDateFormat . '.log',
'commands' => [
ImportCommand::TASK_NAME => [
Task::NAME => ImportCommand::TASK_NAME,

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
return [
'%(path)/db/archive',
'%(path)/config',
'%(tmpDir)/logs/tasks',
'%(tmpDir)/logs',
'%(tmpDir)/cache',
'%(tmpDir)/profiler',
'%(tmpDir)/webhooks',

View File

@@ -10,7 +10,6 @@ use App\Backends\Common\GuidInterface as iGuid;
use App\Backends\Common\Response;
use App\Backends\Jellyfin\JellyfinActionTrait;
use App\Backends\Jellyfin\JellyfinClient as JFC;
use App\Libs\Config;
use App\Libs\Data;
use App\Libs\Entity\StateInterface as iFace;
use App\Libs\Guid;
@@ -528,24 +527,6 @@ class Import
);
if (false === $entity->hasGuids() && false === $entity->hasRelativeGuid()) {
if (true === (bool)Config::get('debug.import')) {
$name = sprintf(
Config::get('tmpDir') . '/debug/%s.%s.json',
$context->backendName,
ag($item, 'Id')
);
if (!file_exists($name)) {
file_put_contents(
$name,
json_encode(
$item,
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_IGNORE
)
);
}
}
$providerIds = (array)ag($item, 'ProviderIds', []);
$message = 'Ignoring [%(backend)] [%(item.title)]. No valid/supported external ids.';

View File

@@ -10,7 +10,6 @@ use App\Backends\Common\GuidInterface as iGuid;
use App\Backends\Common\Response;
use App\Backends\Plex\PlexActionTrait;
use App\Backends\Plex\PlexClient;
use App\Libs\Config;
use App\Libs\Data;
use App\Libs\Entity\StateInterface as iFace;
use App\Libs\Guid;
@@ -574,22 +573,6 @@ class Import
);
if (!$entity->hasGuids() && !$entity->hasRelativeGuid()) {
if (true === (bool)Config::get('debug.import')) {
$name = Config::get(
'tmpDir'
) . '/debug/' . $context->backendName . '.' . $item['ratingKey'] . '.json';
if (!file_exists($name)) {
file_put_contents(
$name,
json_encode(
$item,
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_IGNORE
)
);
}
}
$message = 'Ignoring [%(backend)] [%(item.title)]. No valid/supported external ids.';
if (null === ($item['Guid'] ?? null)) {