forked from clone/flarum-ext-redis-setup
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 27bbee8d1c | |||
| 22d94274d4 | |||
|
|
2f2cce1abe | ||
|
|
78082dc842 | ||
|
|
e02001333b | ||
|
|
44fa68c278 | ||
|
|
139d687e1b | ||
|
|
9061552db9 | ||
|
|
eab24f9adc | ||
|
|
94049c5183 | ||
|
|
96af9b58f6 |
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
**Resolves**
|
||||
<!-- include a link to the issue -->
|
||||
|
||||
**Changes proposed in this pull request:**
|
||||
<!-- mention the pages and/or components which have been impacted -->
|
||||
|
||||
**Reviewers should focus on:**
|
||||
<!-- ask for feedback on specific changes you are unsure about -->
|
||||
|
||||
**Screenshot**
|
||||
<!-- include an image of the most relevant user-facing change, if any -->
|
||||
16
.github/workflows/backend.yml
vendored
Normal file
16
.github/workflows/backend.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
name: GB Redis Setup PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@1.x
|
||||
with:
|
||||
enable_backend_testing: false
|
||||
enable_phpstan: false
|
||||
php_versions: '["7.4", "8.0", "8.1", "8.2", "8.3"]'
|
||||
|
||||
backend_directory: .
|
||||
|
||||
secrets:
|
||||
composer_auth: '{"bearer":{"extiverse.com": "${{secrets.EXTIVERSE_COMPOSER_TOKEN}}"}}'
|
||||
91
.github/workflows/build.yml
vendored
91
.github/workflows/build.yml
vendored
@@ -1,91 +0,0 @@
|
||||
name: JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
env:
|
||||
NODE_VERSION: 16
|
||||
|
||||
jobs:
|
||||
prettier:
|
||||
name: Prettier
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: js/yarn.lock
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: yarn install --immutable
|
||||
working-directory: ./js
|
||||
|
||||
- name: Check JS formatting
|
||||
run: yarn run format-check
|
||||
working-directory: ./js
|
||||
|
||||
build-prod:
|
||||
name: Build and commit
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prettier]
|
||||
|
||||
# Only commit JS on push to master branch
|
||||
# Remember to change in `build-test` job too
|
||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: js/yarn.lock
|
||||
|
||||
# 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
|
||||
- name: Build production JS
|
||||
uses: flarum/action-build@2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build_script: build
|
||||
package_manager: yarn
|
||||
# typings_script: build-typings
|
||||
|
||||
build-test:
|
||||
name: Test build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prettier]
|
||||
|
||||
# Inverse check of `build-prod`
|
||||
# Remember to change in `build-prod` job too
|
||||
if: github.ref != 'refs/heads/master' || github.event_name != 'push'
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: js/yarn.lock
|
||||
|
||||
# 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.
|
||||
- name: Build production JS
|
||||
uses: flarum/action-build@2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build_script: build
|
||||
package_manager: yarn
|
||||
# typings_script: build-typings
|
||||
do_not_commit: true
|
||||
20
.github/workflows/frontend.yml
vendored
Normal file
20
.github/workflows/frontend.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: GB Redis Setup JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/framework/.github/workflows/REUSABLE_frontend.yml@1.x
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./js
|
||||
backend_directory: .
|
||||
js_package_manager: yarn
|
||||
main_git_branch: master
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
composer_auth: '{"bearer":{"extiverse.com": "${{secrets.EXTIVERSE_COMPOSER_TOKEN}}"}}'
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -65,6 +65,7 @@
|
||||
"bmewburn.vscode-intelephense-client",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"felixfbecker.php-debug"
|
||||
"xdebug.php-debug",
|
||||
"firefox-devtools.vscode-firefox-debug"
|
||||
]
|
||||
}
|
||||
|
||||
2
js/dist/admin.js.map
vendored
2
js/dist/admin.js.map
vendored
File diff suppressed because one or more lines are too long
2627
js/yarn.lock
2627
js/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
{
|
||||
$cache = [
|
||||
$base = [
|
||||
'host' => $this->getHost(),
|
||||
'password' => $this->getPassword(),
|
||||
'port' => $this->getPort(),
|
||||
'database' => $this->getCacheDatabase(),
|
||||
'prefix' => $this->getPrefix(),
|
||||
];
|
||||
|
||||
$queue = [
|
||||
'host' => $this->getHost(),
|
||||
'password' => $this->getPassword(),
|
||||
'port' => $this->getPort(),
|
||||
'database' => $this->getQueueDatabase(),
|
||||
'prefix' => $this->getPrefix(),
|
||||
$cache = $base + [
|
||||
'database' => static::getCacheDatabase(),
|
||||
];
|
||||
|
||||
$session = [
|
||||
'host' => $this->getHost(),
|
||||
'password' => $this->getPassword(),
|
||||
'port' => $this->getPort(),
|
||||
'database' => $this->getSessionDatabase(),
|
||||
'prefix' => $this->getPrefix(),
|
||||
$queue = $base + [
|
||||
'database' => static::getQueueDatabase(),
|
||||
];
|
||||
|
||||
$session = $base + [
|
||||
'database' => static::getSessionDatabase(),
|
||||
];
|
||||
|
||||
$config = Arr::add($config, self::CACHE_KEY, $cache);
|
||||
@@ -89,37 +84,37 @@ class EnableRedis implements ExtenderInterface
|
||||
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') : 'redis';
|
||||
}
|
||||
|
||||
private function getPassword(): ?string
|
||||
public static function getPassword(): ?string
|
||||
{
|
||||
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';
|
||||
}
|
||||
|
||||
private function getCacheDatabase(): int
|
||||
public static function getCacheDatabase(): int
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
private function getSessionDatabase(): int
|
||||
public static function getSessionDatabase(): int
|
||||
{
|
||||
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_';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user