UNPKG

bookr-cli

Version:

A terminal-based CLI tool to book time in Jira using the Tempo plugin by parsing your current Git branch name

30 lines 960 B
import fs from 'node:fs'; import path from 'node:path'; import envPaths from 'env-paths'; /** * Load JIRA and Tempo configuration from config file */ export function loadConfigFromFile() { try { const configFile = path.join(envPaths('bookr').config, 'config.json'); if (fs.existsSync(configFile)) { const raw = fs.readFileSync(configFile, 'utf-8'); const parsed = JSON.parse(raw); return { baseUrl: parsed.JIRA_BASE_URL, email: parsed.JIRA_EMAIL, apiToken: parsed.JIRA_API_TOKEN, tempoApiToken: parsed.TEMPO_API_TOKEN, }; } return null; } catch (_e) { return null; } } export function saveConfigToFile(config) { const configFile = path.join(envPaths('bookr').config, 'config.json'); fs.writeFileSync(configFile, JSON.stringify(config, null, 2)); } //# sourceMappingURL=config.js.map