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

55 lines
1.4 KiB
TypeScript
Raw Normal View History

export enum DatabaseType{
2016-06-17 06:05:31 +08:00
memory
}
interface ServerConfig {
port:number;
imagesFolder:string;
thumbnailFolder:string;
databaseType:DatabaseType;
}
interface SearchConfig {
searchEnabled:boolean
instantSearchEnabled:boolean
autocompleteEnabled:boolean
}
interface ClientConfig {
2016-05-12 17:00:46 +08:00
thumbnailSizes:Array<number>;
Search:SearchConfig;
2016-06-17 17:25:15 +08:00
concurrentThumbnailGenerations:number;
enableCache:boolean;
enableOnScrollRendering:boolean;
enableOnScrollThumbnailPrioritising:boolean;
authenticationRequired:boolean;
}
export class ConfigClass {
public Server:ServerConfig = null;
public Client:ClientConfig = {
2016-05-12 17:00:46 +08:00
thumbnailSizes: [200, 400, 600],
Search: {
searchEnabled: false,
instantSearchEnabled: false,
autocompleteEnabled: false
2016-06-17 17:25:15 +08:00
},
concurrentThumbnailGenerations: 1,
enableCache: false,
enableOnScrollRendering: true,
enableOnScrollThumbnailPrioritising: true,
authenticationRequired: true
};
public setDatabaseType(type:DatabaseType) {
this.Server.databaseType = type;
if (type === DatabaseType.memory) {
this.Client.Search.searchEnabled = false;
this.Client.Search.instantSearchEnabled = false;
this.Client.Search.autocompleteEnabled = false;
}
}
}