Skip to content

Commit

Permalink
Merge pull request #382 from arabcoders/dev
Browse files Browse the repository at this point in the history
Expose http listen port as environment variable.
  • Loading branch information
arabcoders authored Dec 12, 2023
2 parents f8d9251 + 1878136 commit b112a48
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 39 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
16 changes: 9 additions & 7 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"` |

---

Expand Down Expand Up @@ -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,...}}
Expand Down
9 changes: 7 additions & 2 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
47 changes: 30 additions & 17 deletions config/backend.spec.php
Original file line number Diff line number Diff line change
@@ -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,
];

7 changes: 0 additions & 7 deletions config/lang.php

This file was deleted.

4 changes: 2 additions & 2 deletions container/files/Caddyfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
http_port 8080
https_port 8443
http_port {$HTTP_PORT}
https_port {$HTTPS_PORT}
}

http:// {
Expand Down
10 changes: 8 additions & 2 deletions src/Commands/Config/EditCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,14 @@ protected function configure(): void
', ',
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
)
)
),
)
]
)
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/Config/ViewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti

$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;
}
}
Expand Down

0 comments on commit b112a48

Please sign in to comment.