mirror of
https://github.com/immich-app/immich.git
synced 2025-01-06 03:46:47 +01:00
feat(server): allow underscores in ML url (#4517)
This commit is contained in:
parent
5a9acbc05b
commit
335216f6dd
2 changed files with 10 additions and 1 deletions
|
@ -6,7 +6,7 @@ export class SystemConfigMachineLearningDto {
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
enabled!: boolean;
|
enabled!: boolean;
|
||||||
|
|
||||||
@IsUrl({ require_tld: false })
|
@IsUrl({ require_tld: false, allow_underscores: true })
|
||||||
@ValidateIf((dto) => dto.enabled)
|
@ValidateIf((dto) => dto.enabled)
|
||||||
url!: string;
|
url!: string;
|
||||||
|
|
||||||
|
|
|
@ -189,6 +189,15 @@ describe(SystemConfigService.name, () => {
|
||||||
expect(configMock.readFile).toHaveBeenCalledWith('immich-config.json');
|
expect(configMock.readFile).toHaveBeenCalledWith('immich-config.json');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow underscores in the machine learning url', async () => {
|
||||||
|
process.env.IMMICH_CONFIG_FILE = 'immich-config.json';
|
||||||
|
const partialConfig = { machineLearning: { url: 'immich_machine_learning' } };
|
||||||
|
configMock.readFile.mockResolvedValue(Buffer.from(JSON.stringify(partialConfig)));
|
||||||
|
|
||||||
|
const config = await sut.getConfig();
|
||||||
|
expect(config.machineLearning.url).toEqual('immich_machine_learning');
|
||||||
|
});
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
{ should: 'validate numbers', config: { ffmpeg: { crf: 'not-a-number' } } },
|
{ should: 'validate numbers', config: { ffmpeg: { crf: 'not-a-number' } } },
|
||||||
{ should: 'validate booleans', config: { oauth: { enabled: 'invalid' } } },
|
{ should: 'validate booleans', config: { oauth: { enabled: 'invalid' } } },
|
||||||
|
|
Loading…
Reference in a new issue