Expose http listen port as environment variable.

This commit is contained in:
abdulmohsen
2023-12-12 21:36:33 +03:00
parent 7f5468fcad
commit 18781367f5
8 changed files with 60 additions and 39 deletions

View File

@@ -13,6 +13,8 @@ ARG USER_ID=1000
ENV IN_CONTAINER=1
ENV PHP_INI_DIR=/etc/${PHP_V}
ENV PATH=/opt/bin:${PATH}
ENV HTTP_PORT="8080"
ENV HTTPS_PORT="8443"
# Setup the required environment.
#

16
FAQ.md
View File

@@ -303,13 +303,14 @@ $ docker exec -ti watchstate console system:tasks
#### Container specific environment variables.
> [!IMPORTANT]
> These environment variables relates to the container itself, and must added via the `docker-compose.yaml` file.
> These environment variables relates to the container itself, and must be added via the `docker-compose.yaml` file.
| Key | Type | Description | Default |
|------------------|---------|------------------------------------|---------|
| WS_DISABLE_HTTP | integer | Disable included `HTTP Server`. | `0` |
| WS_DISABLE_CRON | integer | Disable included `Task Scheduler`. | `0` |
| WS_DISABLE_CACHE | integer | Disable included `Cache Server`. | `0` |
| Key | Type | Description | Default |
|------------------|---------|------------------------------------|----------|
| WS_DISABLE_HTTP | integer | Disable included `HTTP Server`. | `0` |
| WS_DISABLE_CRON | integer | Disable included `Task Scheduler`. | `0` |
| WS_DISABLE_CACHE | integer | Disable included `Cache Server`. | `0` |
| HTTP_PORT | string | Change the `HTTP` listen port. | `"8080"` |
---
@@ -598,7 +599,8 @@ $ curl -v -H "Accept: application/json" -H "X-MediaBrowser-Token: [BACKEND_API_K
```
* Replace `[BACKEND_API_KEY]` with your jellyfin/emby api key.
* Replace `[BACKEND_HOST]` with your jellyfin/emby host. it can be a host or ip:port i.e. `jf.mydomain.ltd` or `172.23.0.11:8096`
* Replace `[BACKEND_HOST]` with your jellyfin/emby host. it can be a host or ip:port i.e. `jf.mydomain.ltd`
or `172.23.0.11:8096`
```
{"OperatingSystemDisplayName":"Linux","HasPendingRestart":false,"IsShuttingDown":false,...}}

View File

@@ -54,9 +54,14 @@ require __DIR__ . '/../vendor/autoload.php';
try {
$app = (new App\Libs\Initializer())->boot();
} catch (Throwable $e) {
$message = sprintf('%s: %s (%s:%d).', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine());
$message = sprintf(
'Unhandled Exception [%s] was thrown. With message [%s] in [%s:%d].',
$e::class,
$e->getMessage(),
array_reverse(explode(ROOT_PATH, $e->getFile(), 2))[0],
$e->getLine()
);
fwrite(STDERR, trim($message) . PHP_EOL);
exit(503);
}

View File

@@ -1,21 +1,34 @@
<?php
/**
* Last update: 2023-12-12
*
* servers.yaml backend spec.
* This file defines the backend spec.
* The dot (.) notation means the key is subarray of the parent key.
* the boolean at the end of the key means if the key should be visible in the config:edit/view command.
*/
return [
'name',
'type',
'url',
'token',
'uuid',
'user',
'import.enabled',
'import.lastSync',
'export.enabled',
'export.lastSync',
'webhook.import',
'webhook.push',
'webhook.match.user',
'webhook.match.uuid',
'webhook.token',
'options.ignore',
'options.DUMP_PAYLOAD',
'name' => true,
'type' => true,
'url' => true,
'token' => true,
'uuid' => true,
'user' => true,
'export.enabled' => true,
'export.lastSync' => true,
'import.enabled' => true,
'import.lastSync' => true,
'webhook.token' => true,
'webhook.match.user' => true,
'webhook.match.uuid' => true,
'options.ignore' => true,
'options.LIBRARY_SEGMENT' => true,
'options.ADMIN_TOKEN' => false,
'options.DUMP_PAYLOAD' => false,
'options.DEBUG_TRACE' => false,
'options.IMPORT_METADATA_ONLY' => false,
'options.DRY_RUN' => false,
'options.client.timeout' => false,
];

View File

@@ -1,7 +0,0 @@
<?php
return (function (): array {
return [
''
];
})();

View File

@@ -1,6 +1,6 @@
{
http_port 8080
https_port 8443
http_port {$HTTP_PORT}
https_port {$HTTPS_PORT}
}
http:// {

View File

@@ -63,8 +63,14 @@ final class EditCommand extends Command
', ',
array_map(
fn($val) => '<value>' . $val . '</value>',
require __DIR__ . '/../../../config/backend.spec.php'
)
array_keys(
array_filter(
array: require __DIR__ . '/../../../config/backend.spec.php',
callback: fn($val, $key) => $val,
mode: ARRAY_FILTER_USE_BOTH
)
)
),
)
]
)

View File

@@ -158,8 +158,8 @@ final class ViewCommand extends Command
$suggest = [];
foreach (require __DIR__ . '/../../../config/backend.spec.php' as $name) {
if (empty($currentValue) || str_starts_with($name, $currentValue)) {
foreach (require __DIR__ . '/../../../config/backend.spec.php' as $name => $val) {
if (true === $val && (empty($currentValue) || str_starts_with($name, $currentValue))) {
$suggest[] = $name;
}
}