mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Merge branch 'bpatrik:master' into master
This commit is contained in:
commit
058484254d
30
.github/workflows/build.yml
vendored
30
.github/workflows/build.yml
vendored
@ -32,9 +32,9 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
@ -87,10 +87,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup Node.js for use with actions
|
name: Setup Node.js for use with actions
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
-
|
-
|
||||||
@ -99,7 +99,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Create Release
|
name: Create Release
|
||||||
run: npm run create-release -- --skip-opt-packages=ffmpeg-static,ffprobe-static --force-opt-packages
|
run: npm run create-release -- --skip-opt-packages=ffmpeg-static,ffprobe-static --force-opt-packages
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: pigallery2-release
|
name: pigallery2-release
|
||||||
path: release
|
path: release
|
||||||
@ -119,29 +119,29 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: pigallery2-release
|
name: pigallery2-release
|
||||||
path: pigallery2-release
|
path: pigallery2-release
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
- name: Build docker
|
- name: Build docker
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/${{ matrix.container }}/Dockerfile.build
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
||||||
platforms: ${{ matrix.platforms }}
|
platforms: ${{ matrix.platforms }}
|
||||||
- name: Push experimental
|
- name: Push experimental
|
||||||
if: ${{ github.ref == 'refs/heads/experimental' }}
|
if: ${{ github.ref == 'refs/heads/experimental' }}
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/${{ matrix.container }}/Dockerfile.build
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
||||||
@ -151,7 +151,7 @@ jobs:
|
|||||||
- name: Push edge on new master commit
|
- name: Push edge on new master commit
|
||||||
# github.ref: branches the format is refs/heads/<branch_name> PRs and Tags are different
|
# github.ref: branches the format is refs/heads/<branch_name> PRs and Tags are different
|
||||||
if: ${{github.ref == 'refs/heads/master' }}
|
if: ${{github.ref == 'refs/heads/master' }}
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/${{ matrix.container }}/Dockerfile.build
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
||||||
@ -160,7 +160,7 @@ jobs:
|
|||||||
tags: bpatrik/pigallery2:edge-${{ matrix.container }}
|
tags: bpatrik/pigallery2:edge-${{ matrix.container }}
|
||||||
- name: Push release on new Tag
|
- name: Push release on new Tag
|
||||||
if: ${{ startsWith(github.ref_type , 'tag') && !github.event.issue.pull_request && matrix.container != 'debian-bullseye'}}
|
if: ${{ startsWith(github.ref_type , 'tag') && !github.event.issue.pull_request && matrix.container != 'debian-bullseye'}}
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/${{ matrix.container }}/Dockerfile.build
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
||||||
@ -172,7 +172,7 @@ jobs:
|
|||||||
bpatrik/pigallery2:latest-${{ matrix.container }}
|
bpatrik/pigallery2:latest-${{ matrix.container }}
|
||||||
- name: Push latest on new Tag
|
- name: Push latest on new Tag
|
||||||
if: ${{ startsWith(github.ref_type, 'tag') && !github.event.issue.pull_request && matrix.container == 'debian-bullseye'}}
|
if: ${{ startsWith(github.ref_type, 'tag') && !github.event.issue.pull_request && matrix.container == 'debian-bullseye'}}
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/${{ matrix.container }}/Dockerfile.build
|
file: docker/${{ matrix.container }}/Dockerfile.build
|
||||||
|
@ -22,9 +22,8 @@ export class ExtensionConfigWrapper {
|
|||||||
// make sure the config file exists by the time we load it.
|
// make sure the config file exists by the time we load it.
|
||||||
// TODO: remove this once typeconfig is fixed and can properly load defaults in arrays
|
// TODO: remove this once typeconfig is fixed and can properly load defaults in arrays
|
||||||
if (!fs.existsSync((pc.__options as ConfigClassOptions<ServerConfig>).configPath)) {
|
if (!fs.existsSync((pc.__options as ConfigClassOptions<ServerConfig>).configPath)) {
|
||||||
await pc.save();
|
await pc.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
await pc.load(); // loading the basic configs, but we do not know the extension config hierarchy yet
|
await pc.load(); // loading the basic configs, but we do not know the extension config hierarchy yet
|
||||||
|
|
||||||
// TODO make sure that all extensions are present even after loading them from file
|
// TODO make sure that all extensions are present even after loading them from file
|
||||||
@ -47,7 +46,7 @@ export class ExtensionConfigWrapper {
|
|||||||
// make sure the config file exists by the time we load it.
|
// make sure the config file exists by the time we load it.
|
||||||
// TODO: remove this once typeconfig is fixed and can properly load defaults in arrays
|
// TODO: remove this once typeconfig is fixed and can properly load defaults in arrays
|
||||||
if (!fs.existsSync((pc.__options as ConfigClassOptions<ServerConfig>).configPath)) {
|
if (!fs.existsSync((pc.__options as ConfigClassOptions<ServerConfig>).configPath)) {
|
||||||
pc.saveSync();
|
pc.loadSync();
|
||||||
}
|
}
|
||||||
pc.loadSync(); // loading the basic configs, but we do not know the extension config hierarchy yet
|
pc.loadSync(); // loading the basic configs, but we do not know the extension config hierarchy yet
|
||||||
// TODO make sure that all extensions are present even after loading them from file
|
// TODO make sure that all extensions are present even after loading them from file
|
||||||
|
@ -15,7 +15,7 @@ const isTesting = process.env['NODE_ENV'] == true || ['afterEach', 'after', 'bef
|
|||||||
.every((fn) => (global as any)[fn] instanceof Function);
|
.every((fn) => (global as any)[fn] instanceof Function);
|
||||||
|
|
||||||
@ConfigClass<IConfigClass<TAGS> & ServerConfig>({
|
@ConfigClass<IConfigClass<TAGS> & ServerConfig>({
|
||||||
configPath: path.join(__dirname, !isTesting ? './../../../../config.json' : './../../../../test/backend/tmp/config.json'),
|
configPath: path.join(__dirname, !isTesting ? './../../../../config.json' : './../../../../test/tmp/config.json'),
|
||||||
crateConfigPathIfNotExists: isTesting,
|
crateConfigPathIfNotExists: isTesting,
|
||||||
saveIfNotExist: true,
|
saveIfNotExist: true,
|
||||||
attachDescription: true,
|
attachDescription: true,
|
||||||
|
25
test/common/unit/config/Config.ts
Normal file
25
test/common/unit/config/Config.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import {expect} from 'chai';
|
||||||
|
import {ConfigClassBuilder} from 'typeconfig/node';
|
||||||
|
import {ExtensionConfigWrapper} from '../../../../src/backend/model/extension/ExtensionConfigWrapper';
|
||||||
|
import {TestHelper} from '../../../TestHelper';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
|
|
||||||
|
describe('Config', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await fs.promises.rm(TestHelper.TMP_DIR, {recursive: true, force: true});
|
||||||
|
});
|
||||||
|
afterEach(async () => {
|
||||||
|
await fs.promises.rm(TestHelper.TMP_DIR, {recursive: true, force: true});
|
||||||
|
});
|
||||||
|
it('should load default from env', () => {
|
||||||
|
process.env['default-Media-tempFolder'] = 'test/test';
|
||||||
|
const conf = ExtensionConfigWrapper.originalSync();
|
||||||
|
expect(conf.Media.tempFolder).to.be.equal('test/test');
|
||||||
|
expect(ConfigClassBuilder.attachPrivateInterface(conf.Media).__defaults.tempFolder).to.be.equal('test/test');
|
||||||
|
expect(process.env['default-Media-tempFolder']).to.be.equal('test/test');
|
||||||
|
const conf2 = ExtensionConfigWrapper.originalSync();
|
||||||
|
expect(ConfigClassBuilder.attachPrivateInterface(conf2.Media).__defaults.tempFolder).to.be.equal('test/test');
|
||||||
|
expect(conf2.Media.tempFolder).to.be.equal('test/test');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user