Files
towercontrol/lib/config.ts
Julien Froidefond f751e5966e feat: complete integration of macOS reminders with filtering and logging
- Marked tasks in TODO.md as completed for macOS reminders integration.
- Enhanced RemindersService to filter reminders based on enabled lists and added detailed logging for better debugging.
- Implemented methods for retrieving reminders from specific lists and parsing output from AppleScript.
2025-09-13 13:49:35 +02:00

79 lines
1.9 KiB
TypeScript

/**
* Configuration de l'application TowerControl
*/
export interface AppConfig {
reminders: {
targetList: string;
syncInterval: number; // en minutes
enabledLists: string[];
};
jira: {
baseUrl?: string;
username?: string;
apiToken?: string;
projects: string[];
};
sync: {
autoSync: boolean;
batchSize: number;
};
}
// Configuration par défaut
const defaultConfig: AppConfig = {
reminders: {
targetList: process.env.REMINDERS_TARGET_LIST || 'Boulot',
syncInterval: parseInt(process.env.REMINDERS_SYNC_INTERVAL || '15'),
enabledLists: (process.env.REMINDERS_ENABLED_LISTS || 'Boulot').split(',')
},
jira: {
baseUrl: process.env.JIRA_BASE_URL,
username: process.env.JIRA_USERNAME,
apiToken: process.env.JIRA_API_TOKEN,
projects: (process.env.JIRA_PROJECTS || '').split(',').filter(p => p.length > 0)
},
sync: {
autoSync: process.env.AUTO_SYNC === 'true',
batchSize: parseInt(process.env.SYNC_BATCH_SIZE || '50')
}
};
/**
* Récupère la configuration de l'application
*/
export function getConfig(): AppConfig {
return defaultConfig;
}
/**
* Récupère la liste cible des rappels
*/
export function getTargetRemindersList(): string {
return getConfig().reminders.targetList;
}
/**
* Récupère les listes autorisées pour la synchronisation
*/
export function getEnabledRemindersLists(): string[] {
return getConfig().reminders.enabledLists;
}
/**
* Vérifie si une liste est autorisée pour la synchronisation
*/
export function isListEnabled(listName: string): boolean {
const enabledLists = getEnabledRemindersLists();
return enabledLists.includes(listName);
}
/**
* Configuration pour le développement/debug
*/
export const DEBUG_CONFIG = {
logAppleScript: process.env.NODE_ENV === 'development',
mockData: process.env.USE_MOCK_DATA === 'true',
verboseLogging: process.env.VERBOSE_LOGGING === 'true'
};