2017-06-04 21:25:08 +08:00
|
|
|
import {PublicConfigClass} from "../public/ConfigClass";
|
2017-07-28 05:10:16 +08:00
|
|
|
import {
|
|
|
|
DatabaseType,
|
|
|
|
IPrivateConfig,
|
|
|
|
ReIndexingSensitivity,
|
|
|
|
ServerConfig,
|
|
|
|
ThumbnailProcessingLib
|
|
|
|
} from "./IPrivateConfig";
|
2017-07-08 18:43:42 +08:00
|
|
|
import * as path from "path";
|
|
|
|
import {ConfigLoader} from "typeconfig";
|
2017-06-04 21:25:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This configuration will be only at backend
|
|
|
|
*/
|
2017-07-08 18:43:42 +08:00
|
|
|
export class PrivateConfigClass extends PublicConfigClass implements IPrivateConfig {
|
2017-06-04 21:25:08 +08:00
|
|
|
|
2017-06-12 05:33:47 +08:00
|
|
|
public Server: ServerConfig = {
|
|
|
|
port: 80,
|
|
|
|
imagesFolder: "demo/images",
|
|
|
|
thumbnail: {
|
|
|
|
folder: "demo/TEMP",
|
|
|
|
processingLibrary: ThumbnailProcessingLib.sharp,
|
|
|
|
qualityPriority: true
|
|
|
|
},
|
2017-07-16 16:59:28 +08:00
|
|
|
sessionTimeout: 1000 * 60 * 60 * 24 * 7,
|
2017-06-12 05:33:47 +08:00
|
|
|
database: {
|
2017-07-21 05:37:10 +08:00
|
|
|
type: DatabaseType.sqlite,
|
2017-06-12 05:33:47 +08:00
|
|
|
mysql: {
|
2017-07-14 05:39:09 +08:00
|
|
|
host: "",
|
|
|
|
username: "",
|
|
|
|
password: "",
|
|
|
|
database: ""
|
2017-06-04 21:25:08 +08:00
|
|
|
|
2017-07-21 05:37:10 +08:00
|
|
|
},
|
|
|
|
sqlite: {
|
|
|
|
storage: "sqlite.db"
|
2017-06-12 05:33:47 +08:00
|
|
|
}
|
|
|
|
},
|
2017-07-04 01:17:49 +08:00
|
|
|
sharing: {
|
|
|
|
updateTimeout: 1000 * 60 * 5
|
|
|
|
},
|
2017-07-28 05:10:16 +08:00
|
|
|
indexing: {
|
|
|
|
folderPreviewSize: 2,
|
|
|
|
cachedFolderTimeout: 1000 * 60 * 60,
|
|
|
|
reIndexingSensitivity: ReIndexingSensitivity.high
|
|
|
|
},
|
|
|
|
enableThreading: true
|
2017-06-12 05:33:47 +08:00
|
|
|
};
|
2017-07-08 18:43:42 +08:00
|
|
|
private ConfigLoader: any;
|
2017-06-04 21:25:08 +08:00
|
|
|
|
2017-06-12 05:33:47 +08:00
|
|
|
public setDatabaseType(type: DatabaseType) {
|
|
|
|
this.Server.database.type = type;
|
|
|
|
if (type === DatabaseType.memory) {
|
2017-07-14 05:39:09 +08:00
|
|
|
this.Client.Search.enabled = false;
|
|
|
|
this.Client.Sharing.enabled = false;
|
2017-06-04 21:25:08 +08:00
|
|
|
}
|
2017-06-12 05:33:47 +08:00
|
|
|
}
|
2017-06-04 21:25:08 +08:00
|
|
|
|
2017-07-08 18:43:42 +08:00
|
|
|
public load() {
|
|
|
|
ConfigLoader.loadBackendConfig(this,
|
|
|
|
path.join(__dirname, './../../../config.json'),
|
|
|
|
[["PORT", "Server-port"]]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public save() {
|
|
|
|
ConfigLoader.saveConfigFile(path.join(__dirname, './../../../config.json'), this);
|
|
|
|
}
|
2017-07-13 00:31:19 +08:00
|
|
|
|
|
|
|
public original(): PrivateConfigClass {
|
|
|
|
let cfg = new PrivateConfigClass();
|
|
|
|
cfg.load();
|
|
|
|
return cfg;
|
|
|
|
}
|
2017-06-04 21:25:08 +08:00
|
|
|
}
|
|
|
|
|