1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/benchmark/BMConfig.ts

63 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-04-05 01:37:31 +08:00
/* eslint-disable @typescript-eslint/no-inferrable-types */
2020-12-29 05:08:57 +08:00
import * as path from 'path';
2022-04-05 01:37:31 +08:00
import { ConfigClass, ConfigClassBuilder } from 'typeconfig/node';
import { ConfigProperty, SubConfigClass } from 'typeconfig/common';
@SubConfigClass()
2022-04-05 01:37:31 +08:00
export class BenchmarksConfig {
@ConfigProperty()
bmScanDirectory: boolean = true;
@ConfigProperty()
bmSaveDirectory: boolean = true;
@ConfigProperty()
bmListDirectory: boolean = true;
@ConfigProperty()
bmListPersons: boolean = true;
@ConfigProperty()
bmAllSearch: boolean = true;
@ConfigProperty()
bmAutocomplete: boolean = true;
}
2020-12-29 05:08:57 +08:00
@ConfigClass({
configPath: path.join(__dirname, './../bm_config.json'),
saveIfNotExist: true,
attachDescription: true,
enumsAsString: true,
softReadonly: true,
cli: {
2020-12-31 04:13:19 +08:00
prefix: 'bm-config',
2020-12-29 05:08:57 +08:00
enable: {
configPath: true,
attachState: true,
attachDescription: true,
rewriteCLIConfig: true,
rewriteENVConfig: true,
enumsAsString: true,
saveIfNotExist: true,
2022-04-05 01:37:31 +08:00
exitOnConfig: true,
2020-12-29 05:08:57 +08:00
},
defaults: {
2022-04-05 01:37:31 +08:00
enabled: true,
},
},
2020-12-29 05:08:57 +08:00
})
export class PrivateConfigClass {
2022-04-05 01:37:31 +08:00
@ConfigProperty({
description:
'Images are loaded from this folder (read permission required)',
})
2020-12-31 21:26:45 +08:00
path: string = '/app/data/images';
2022-04-05 01:37:31 +08:00
@ConfigProperty({ description: 'Describe your system setup' })
2020-12-29 05:08:57 +08:00
system: string = '';
2022-04-05 01:37:31 +08:00
@ConfigProperty({ description: 'Number of times to run the benchmark' })
2020-12-31 04:13:19 +08:00
RUNS: number = 50;
2022-04-05 01:37:31 +08:00
@ConfigProperty({ description: 'Enables / disables benchmarks' })
Benchmarks: BenchmarksConfig = new BenchmarksConfig();
2020-12-29 05:08:57 +08:00
}
2022-04-05 01:37:31 +08:00
export const BMConfig = ConfigClassBuilder.attachInterface(
new PrivateConfigClass()
);
2020-12-29 05:08:57 +08:00
BMConfig.loadSync();