mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
44 lines
961 B
TypeScript
44 lines
961 B
TypeScript
|
export enum DatabaseType{
|
||
|
memory, mongoDB
|
||
|
}
|
||
|
|
||
|
interface ServerConfig {
|
||
|
port:number;
|
||
|
thumbnailSizes:Array<number>;
|
||
|
imagesFolder:string;
|
||
|
thumbnailFolder:string;
|
||
|
databaseType:DatabaseType;
|
||
|
}
|
||
|
|
||
|
interface SearchConfig {
|
||
|
searchEnabled:boolean
|
||
|
instantSearchEnabled:boolean
|
||
|
autocompleteEnabled:boolean
|
||
|
}
|
||
|
|
||
|
interface ClientConfig {
|
||
|
Search:SearchConfig;
|
||
|
}
|
||
|
export class ConfigClass {
|
||
|
|
||
|
public Server:ServerConfig = null;
|
||
|
|
||
|
public Client:ClientConfig = {
|
||
|
Search: {
|
||
|
searchEnabled: true,
|
||
|
instantSearchEnabled: true,
|
||
|
autocompleteEnabled: 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;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|