style:优化代码格式,提高可读性
This commit is contained in:
@@ -4,7 +4,7 @@ const config = {
|
||||
app: {
|
||||
port: process.env.PORT || 3000,
|
||||
dbPath: process.env.DB_FILE_PATH || './sync.sqlite',
|
||||
rate : process.env.RATE_LIMIT_WINDOW || 10000,
|
||||
rate: process.env.RATE_LIMIT_WINDOW || 10000,
|
||||
maxRequests: process.env.MAX_REQUESTS_PER_WINDOW || 20,
|
||||
debugMode: process.env.DEBUG_MODE === 'true',
|
||||
logRetentionDays: process.env.LOG_RETENTION_DAYS || 30
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// 读取配置文件路径
|
||||
//读取配置文件路径
|
||||
const configPath = path.join(__dirname, '../../mappings.json');
|
||||
|
||||
let mappingsConfig = null;
|
||||
@@ -14,14 +14,14 @@ function loadMappings() {
|
||||
if (mappingsConfig) {
|
||||
return mappingsConfig;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
const configContent = fs.readFileSync(configPath, 'utf8');
|
||||
mappingsConfig = JSON.parse(configContent);
|
||||
|
||||
// 处理环境变量替换
|
||||
|
||||
//处理环境变量替换
|
||||
processEnvVariables(mappingsConfig);
|
||||
|
||||
|
||||
return mappingsConfig;
|
||||
} catch (error) {
|
||||
throw new Error(`无法加载映射配置文件 ${configPath}: ${error.message}`);
|
||||
@@ -86,11 +86,11 @@ const defaultMappings = new Proxy({}, {
|
||||
function getRepoConfig(repoFullName) {
|
||||
const config = loadMappings();
|
||||
const repoConfig = config.repositories[repoFullName];
|
||||
|
||||
|
||||
if (!repoConfig) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
jira: repoConfig.jira,
|
||||
priorities: repoConfig.priorities || config.defaultMappings.priorities,
|
||||
@@ -117,7 +117,7 @@ function getConfiguredRepos() {
|
||||
*/
|
||||
function getRepoByJiraProject(jiraProjectKey) {
|
||||
const config = loadMappings();
|
||||
|
||||
|
||||
for (const [repoKey, repoConfig] of Object.entries(config.repositories)) {
|
||||
if (repoConfig.jira && repoConfig.jira.projectKey === jiraProjectKey) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user