1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-14 11:23:17 +02:00
pigallery2/common/config/Config.ts

45 lines
1002 B
TypeScript
Raw Normal View History

export enum DatabaseType{
memory, mongoDB
}
interface ServerConfig {
port:number;
imagesFolder:string;
thumbnailFolder:string;
databaseType:DatabaseType;
}
interface SearchConfig {
searchEnabled:boolean
instantSearchEnabled:boolean
autocompleteEnabled:boolean
}
interface ClientConfig {
2016-05-12 11:00:46 +02:00
thumbnailSizes:Array<number>;
Search:SearchConfig;
}
export class ConfigClass {
public Server:ServerConfig = null;
public Client:ClientConfig = {
2016-05-12 11:00:46 +02:00
thumbnailSizes: [200, 400, 600],
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;
}
}
}