mirror of
https://github.com/glowingblue/flarum-ext-redis-setup.git
synced 2026-03-22 06:57:45 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eab24f9adc | ||
|
|
94049c5183 | ||
|
|
96af9b58f6 |
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -52,7 +52,7 @@ jobs:
|
|||||||
# Our action will install node, npm and yarn, cd into `./js`, run `yarn run build` (and
|
# Our action will install node, npm and yarn, cd into `./js`, run `yarn run build` (and
|
||||||
# `yarn run build-typings` if desired), then commit and upload any changes
|
# `yarn run build-typings` if desired), then commit and upload any changes
|
||||||
- name: Build production JS
|
- name: Build production JS
|
||||||
uses: flarum/action-build@2
|
uses: flarum/action-build@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build_script: build
|
build_script: build
|
||||||
@@ -82,7 +82,7 @@ jobs:
|
|||||||
# Our action will install node, npm and yarn, cd into `./js`, run `yarn run build` (and
|
# Our action will install node, npm and yarn, cd into `./js`, run `yarn run build` (and
|
||||||
# `yarn run build-typings` if desired). It will NOT commit and upload.
|
# `yarn run build-typings` if desired). It will NOT commit and upload.
|
||||||
- name: Build production JS
|
- name: Build production JS
|
||||||
uses: flarum/action-build@2
|
uses: flarum/action-build@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build_script: build
|
build_script: build
|
||||||
|
|||||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -65,6 +65,7 @@
|
|||||||
"bmewburn.vscode-intelephense-client",
|
"bmewburn.vscode-intelephense-client",
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"felixfbecker.php-debug"
|
"xdebug.php-debug",
|
||||||
|
"firefox-devtools.vscode-firefox-debug"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of glowingblue/redis-setup.
|
* This file is part of glowingblue/redis-setup.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2022 Glowing Blue AG.
|
* Copyright (c) 2023 Glowing Blue AG.
|
||||||
* Authors: Ian Morland, iPurpl3x, Rafael Horvat.
|
* Authors: Ian Morland, iPurpl3x, Rafael Horvat.
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE.md
|
* For the full copyright and license information, please view the LICENSE.md
|
||||||
@@ -58,28 +58,23 @@ class EnableRedis implements ExtenderInterface
|
|||||||
|
|
||||||
private function buildConfig($config = []): array
|
private function buildConfig($config = []): array
|
||||||
{
|
{
|
||||||
$cache = [
|
$base = [
|
||||||
'host' => $this->getHost(),
|
'host' => $this->getHost(),
|
||||||
'password' => $this->getPassword(),
|
'password' => $this->getPassword(),
|
||||||
'port' => $this->getPort(),
|
'port' => $this->getPort(),
|
||||||
'database' => $this->getCacheDatabase(),
|
|
||||||
'prefix' => $this->getPrefix(),
|
'prefix' => $this->getPrefix(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$queue = [
|
$cache = $base + [
|
||||||
'host' => $this->getHost(),
|
'database' => static::getCacheDatabase(),
|
||||||
'password' => $this->getPassword(),
|
|
||||||
'port' => $this->getPort(),
|
|
||||||
'database' => $this->getQueueDatabase(),
|
|
||||||
'prefix' => $this->getPrefix(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$session = [
|
$queue = $base + [
|
||||||
'host' => $this->getHost(),
|
'database' => static::getQueueDatabase(),
|
||||||
'password' => $this->getPassword(),
|
];
|
||||||
'port' => $this->getPort(),
|
|
||||||
'database' => $this->getSessionDatabase(),
|
$session = $base + [
|
||||||
'prefix' => $this->getPrefix(),
|
'database' => static::getSessionDatabase(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$config = Arr::add($config, self::CACHE_KEY, $cache);
|
$config = Arr::add($config, self::CACHE_KEY, $cache);
|
||||||
@@ -89,37 +84,37 @@ class EnableRedis implements ExtenderInterface
|
|||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getHost(): string
|
public static function getHost(): string
|
||||||
{
|
{
|
||||||
return getenv('REDIS_HOST') ? getenv('REDIS_HOST') : '127.0.0.1';
|
return getenv('REDIS_HOST') ? getenv('REDIS_HOST') : '127.0.0.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPassword(): ?string
|
public static function getPassword(): ?string
|
||||||
{
|
{
|
||||||
return getenv('REDIS_PASSWORD') ? getenv('REDIS_PASSWORD') : null;
|
return getenv('REDIS_PASSWORD') ? getenv('REDIS_PASSWORD') : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPort(): string
|
public static function getPort(): string
|
||||||
{
|
{
|
||||||
return getenv('REDIS_PORT') ? getenv('REDIS_PORT') : '6379';
|
return getenv('REDIS_PORT') ? getenv('REDIS_PORT') : '6379';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCacheDatabase(): int
|
public static function getCacheDatabase(): int
|
||||||
{
|
{
|
||||||
return (int) getenv('REDIS_DATABASE_CACHE') ? getenv('REDIS_DATABASE_CACHE') : 1;
|
return (int) getenv('REDIS_DATABASE_CACHE') ? getenv('REDIS_DATABASE_CACHE') : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getQueueDatabase(): int
|
public static function getQueueDatabase(): int
|
||||||
{
|
{
|
||||||
return (int) getenv('REDIS_DATABASE_QUEUE') ? getenv('REDIS_DATABASE_QUEUE') : 2;
|
return (int) getenv('REDIS_DATABASE_QUEUE') ? getenv('REDIS_DATABASE_QUEUE') : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSessionDatabase(): int
|
public static function getSessionDatabase(): int
|
||||||
{
|
{
|
||||||
return (int) getenv('REDIS_DATABASE_SESSION') ? getenv('REDIS_DATABASE_SESSION') : 3;
|
return (int) getenv('REDIS_DATABASE_SESSION') ? getenv('REDIS_DATABASE_SESSION') : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPrefix(): string
|
public static function getPrefix(): string
|
||||||
{
|
{
|
||||||
return getenv('REDIS_PREFIX') ? getenv('REDIS_PREFIX') : 'flarum_';
|
return getenv('REDIS_PREFIX') ? getenv('REDIS_PREFIX') : 'flarum_';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user