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!N@tur3!', /** * @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 }, sso:{ FACEBOOK_APP_ID:'your_fb_app_id', FACEBOOK_APP_SECRET:'your_fb_app_secret', GOOGLE_CLIENT_ID:'your_google_client_id', GOOGLE_CLIENT_SECRET:'your_google_client_secret' } } /** * 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 };