1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

70 lines
1.7 KiB
TypeScript
Raw Normal View History

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