rangement/conf/configs.ts

63 lines
1.5 KiB
TypeScript

import mainTemplates from './mainTemplates'
import constants from './folders'
import cv from './controlled_vocabulary'
import log, {LogLevelDesc} from 'loglevel'
interface ConfigOverride {
iso_date_format?: string,
log_actions?: string,
log_level?: 'debug' | 'warn' | 'info',
}
/**
* configuration générale à importer dans les utilitaires
*/
class config_rangement {
// log_level: LogLevelDesc = 'debug' // 'debug' | 'warn' |'info'
log_level: LogLevelDesc = 'info' // 'debug' | 'warn' |'info'
version = '1.0.0'
iso_date_format = 'yyyy-MM-DDTHH.mm.ss' // target format for dates in file names
tagSeparator = ' '
tagSectionSeparator = '--'
keepFreeText = true
keepTags = true
replaceUnderscoreWithSpaces = true
renameFolders = false
enableTestsLocally = false
reportStatistics = true
controlled_vocabulary = cv
constants = constants
base_archive_folder = constants.base_archive_folder
templates = mainTemplates;
statistics = {};
keepOriginalNameInRename = false;
log_actions = true;
/**
* override config if we want
* @param overridingConfig
*/
constructor(overridingConfig?: ConfigOverride) {
log.setLevel('info')
if (overridingConfig) {
log.debug('configuration is overrided')
let keys = Object.keys(overridingConfig)
let self: any = this;
keys.forEach((elem, index) => {
if (self[keys[index]]) {
self[keys[index]] = elem
}
})
}
}
}
const rangement_instance = new config_rangement({});
export default rangement_instance