-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.php
More file actions
28 lines (22 loc) · 1.06 KB
/
setup.php
File metadata and controls
28 lines (22 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
$configDefaults = [
'plexRootDir' => ['Plex media root directory? (Only for docker installs)', null],
'containerRootDir' => ['Plex media root directory within the container? (Only for docker installs)', null],
'cacheRootDir' => ['Local cache root directory? (This directory should be empty! The program will iteratively destroy files within!)', null],
'onDeckLimit' => ['How many on-deck items should be cached at most?', 5],
'gbLimit' => ['How much cache can be used for on-deck video storage?', 10],
'plexUrl' => ['Plex URL?', null],
'port' => ['Plex port?', 32400],
'useSsl' => ['Use SSL?', true],
'plexToken' => ['Plex API Token?', null],
];
$config = [];
echo "Setting up plex-local-cache.\n";
foreach ($configDefaults as $key => list($description, $defaultValue)) {
if ($defaultValue !== null) {
$description .= " [{$defaultValue}]";
}
$value = trim(readline("{$description}: "));
$config[$key] = $value ?: $defaultValue;
}
file_put_contents(__DIR__ . '/config.json', json_encode($config, JSON_PRETTY_PRINT));