2016-05-10 21:33:58 +02:00
|
|
|
export enum DatabaseType{
|
2016-12-27 17:09:47 +02:00
|
|
|
memory = 0, mysql = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
interface MySQLConfig {
|
|
|
|
host: string;
|
|
|
|
database: string;
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
}
|
|
|
|
interface DataBaseConfig {
|
|
|
|
type: DatabaseType;
|
|
|
|
mysql?: MySQLConfig;
|
2016-05-10 21:33:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
interface ServerConfig {
|
|
|
|
port:number;
|
|
|
|
imagesFolder:string;
|
|
|
|
thumbnailFolder:string;
|
2016-12-27 17:09:47 +02:00
|
|
|
database: DataBaseConfig;
|
2016-05-10 21:33:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
interface SearchConfig {
|
|
|
|
searchEnabled:boolean
|
|
|
|
instantSearchEnabled:boolean
|
|
|
|
autocompleteEnabled:boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ClientConfig {
|
2016-05-12 11:00:46 +02:00
|
|
|
thumbnailSizes:Array<number>;
|
2016-05-10 21:33:58 +02:00
|
|
|
Search:SearchConfig;
|
2016-06-17 11:25:15 +02:00
|
|
|
concurrentThumbnailGenerations:number;
|
2016-06-26 15:53:48 +02:00
|
|
|
enableCache:boolean;
|
|
|
|
enableOnScrollRendering:boolean;
|
|
|
|
enableOnScrollThumbnailPrioritising:boolean;
|
2016-07-07 12:19:08 +02:00
|
|
|
authenticationRequired:boolean;
|
2016-05-10 21:33:58 +02:00
|
|
|
}
|
|
|
|
export class ConfigClass {
|
|
|
|
|
|
|
|
public Server:ServerConfig = null;
|
|
|
|
|
|
|
|
public Client:ClientConfig = {
|
2016-05-12 11:00:46 +02:00
|
|
|
thumbnailSizes: [200, 400, 600],
|
2016-05-10 21:33:58 +02:00
|
|
|
Search: {
|
2016-12-28 12:50:05 +02:00
|
|
|
searchEnabled: true,
|
|
|
|
instantSearchEnabled: true,
|
|
|
|
autocompleteEnabled: true
|
2016-06-17 11:25:15 +02:00
|
|
|
},
|
2016-06-26 15:53:48 +02:00
|
|
|
concurrentThumbnailGenerations: 1,
|
|
|
|
enableCache: false,
|
|
|
|
enableOnScrollRendering: true,
|
2016-07-07 12:19:08 +02:00
|
|
|
enableOnScrollThumbnailPrioritising: true,
|
2016-07-07 13:56:39 +02:00
|
|
|
authenticationRequired: true
|
2016-05-10 21:33:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
public setDatabaseType(type:DatabaseType) {
|
2016-12-27 17:09:47 +02:00
|
|
|
this.Server.database.type = type;
|
2016-05-10 21:33:58 +02:00
|
|
|
if (type === DatabaseType.memory) {
|
|
|
|
this.Client.Search.searchEnabled = false;
|
|
|
|
this.Client.Search.instantSearchEnabled = false;
|
|
|
|
this.Client.Search.autocompleteEnabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|