Skip to content

Commit

Permalink
Allow setting custom Red-Index URL through env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen committed Jun 10, 2023
1 parent 3b2a192 commit 06bff13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docker-compose.override-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
app:
environment:
RED_INDEX_URL: /opt/red-index
volumes:
- /home/ubuntu/work/Red-Index/index:/opt/red-index
6 changes: 5 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ function getURL(
$filter_tag = strtolower(preg_replace('/[^-a-zA-Z0-9_]/', '', getString($_GET, 'filter_tag')));
$page = intval(preg_replace('/[^0-9]/', '', getString($_GET, 'p'))) ?: 1;

$json = json_decode(implode(" ", file('https://raw.githubusercontent.com/Cog-Creators/Red-Index/master/index/1-min.json')), TRUE);
$red_index_url = getenv("RED_INDEX_URL", true);
if (!$red_index_url) {
$red_index_url = 'https://raw.githubusercontent.com/Cog-Creators/Red-Index/master/index';
}
$json = json_decode(implode(" ", file($red_index_url . '/1-min.json')), TRUE);
$cogs = [];
foreach ($json as $source => $sourceData) {
$repo_url = explode('@', $source, 2)[0];
Expand Down

0 comments on commit 06bff13

Please sign in to comment.