2023-07-19 12:32:13 +02:00
|
|
|
import mainTemplates from './mainTemplates'
|
|
|
|
import constants from './folders'
|
|
|
|
import cv from './controlled_vocabulary'
|
|
|
|
|
|
|
|
|
|
|
|
import log, {LogLevelDesc} from 'loglevel'
|
|
|
|
|
|
|
|
interface ConfigOverride {
|
2023-09-10 11:30:50 +02:00
|
|
|
iso_date_format?: string,
|
|
|
|
log_actions?: string,
|
|
|
|
log_level?: 'debug' | 'warn' | 'info',
|
2023-07-19 12:32:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* configuration générale à importer dans les utilitaires
|
|
|
|
*/
|
|
|
|
class config_rangement {
|
2024-01-02 23:37:40 +01:00
|
|
|
// log_level: LogLevelDesc = 'debug' // 'debug' | 'warn' |'info'
|
|
|
|
log_level: LogLevelDesc = 'info' // 'debug' | 'warn' |'info'
|
2023-09-10 11:30:50 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-07-19 12:32:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const rangement_instance = new config_rangement({});
|
|
|
|
export default rangement_instance
|