-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix language extensions and make schedule/paths customizable
- Loading branch information
John Corser
committed
Jan 26, 2025
1 parent
f4e18c7
commit 40190a5
Showing
7 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
export interface ScanConfig { | ||
includePaths: string[]; | ||
excludePaths: string[]; | ||
} | ||
|
||
function validatePath(path: string): boolean { | ||
// Add any path validation logic you need | ||
return path.startsWith('/') && !path.includes('..'); | ||
} | ||
|
||
export function getScanConfig(): ScanConfig { | ||
const scanPaths = process.env.SCAN_PATHS?.split(',').filter(Boolean) || ['/scan_dir']; | ||
const excludePaths = process.env.EXCLUDE_PATHS?.split(',').filter(Boolean) || []; | ||
|
||
// Validate paths | ||
const validIncludePaths = scanPaths.filter((path) => { | ||
const isValid = validatePath(path); | ||
if (!isValid) { | ||
console.warn(`Invalid include path: ${path}`); | ||
} | ||
return isValid; | ||
}); | ||
|
||
const validExcludePaths = excludePaths.filter((path) => { | ||
const isValid = validatePath(path); | ||
if (!isValid) { | ||
console.warn(`Invalid exclude path: ${path}`); | ||
} | ||
return isValid; | ||
}); | ||
|
||
if (validIncludePaths.length === 0) { | ||
console.warn('No valid scan paths provided, defaulting to /scan_dir'); | ||
validIncludePaths.push('/scan_dir'); | ||
} | ||
|
||
console.log('Scan configuration:', { | ||
includePaths: validIncludePaths, | ||
excludePaths: validExcludePaths, | ||
}); | ||
|
||
return { | ||
includePaths: validIncludePaths, | ||
excludePaths: validExcludePaths, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters