mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
export enum DatabaseType{
|
|
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;
|
|
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 = {
|
|
thumbnailSizes: [200, 400, 600],
|
|
iconSize: 30,
|
|
Search: {
|
|
searchEnabled: true,
|
|
instantSearchEnabled: true,
|
|
autocompleteEnabled: true
|
|
},
|
|
concurrentThumbnailGenerations: 1,
|
|
enableCache: false,
|
|
enableOnScrollRendering: true,
|
|
enableOnScrollThumbnailPrioritising: true,
|
|
authenticationRequired: true,
|
|
googleApiKey: ""
|
|
};
|
|
|
|
public setDatabaseType(type: DatabaseType) {
|
|
this.Server.database.type = type;
|
|
if (type === DatabaseType.memory) {
|
|
this.Client.Search.searchEnabled = false;
|
|
this.Client.Search.instantSearchEnabled = false;
|
|
this.Client.Search.autocompleteEnabled = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
|