import path from 'path' const pe = process.env; /** * Configuration class */ class Config{ name = 'config'; /** * @class File system options , repository setup * @alias FileSystemOptions * @memberof Config */ fs = { /** Repository path * @type {string} * @memberof FileSystemOptions */ repo: null } /** * @class Database options * @alias DatabaseOptions * @memberof Config */ db = { /** Database name * @type {string} * @memberof DatabaseOptions */ name:'pronature', /** Database connection string * @type {string} * @memberof DatabaseOptions */ url: "mongodb://127.0.0.1:27017/pronature" } /** * @class Web site endpoint options * @alias SiteOptions * @memberof Config */ site = { /** Host name * @type {string} * @memberof SiteOptions */ host:'https://localhost:5173', /** Whether to use SSL * @type {boolean} * @memberof SiteOptions */ ssl: !!parseInt(pe.SRV_SSL), /** Port to use * @type {Number} * @memberof SiteOptions */ port: pe.SRV_PORT, /** * @class Certificate data * @alias CertificateOptions * @memberof SiteOptions */ certificate: { /** * Certificate private key * @type {string} * @memberof CertificateOptions */ key: './.cert/dev-key.pem', /** * Certificate public key * @type {string} * @memberof CertificateOptions */ cert: './.cert/dev-cert.pem', /** * PK Passphrase * @type {string} * @memberof CertificateOptions */ passphrase: 'parola' }, } /** * @class Access management options * @alias AccessManagementOptions * @memberof Config */ am = { /** * Salt, a string to be used in order to make a more complex password hash * @type {string} * @memberof AccessManagementOptions */ salt : 'P@ssSal7y!!', /** * @class Cookie options * @alias CookieOptions * @memberof AccessManagementOptions */ cookie: { /** * Cookie secret * @type {string} * @memberof CookieOptions */ secret: 'S3cret4C00k!ie$', /** * Cookie max age (in seconds) * @type {Number} * @memberof CookieOptions */ maxAge: 1000 * 60 * 60 * 24 * 7 } } /** * Initializes the configuration * @param {App} app The application */ async init(app){ if (!this.fs.repo){ this.fs.repo = path.resolve(`${app.root}/repo`) + '/'; } } /** * Starts the configuration plugin * @param {App} app the application instance */ async start(app){ } } export { Config };