2024-04-19 12:24:43 +00:00
|
|
|
import 'dotenv/config';
|
|
|
|
|
|
|
|
const {
|
2024-06-25 05:54:16 +00:00
|
|
|
FETCH_MODE,
|
|
|
|
INCLUDED_DIRS,
|
2024-04-19 12:24:43 +00:00
|
|
|
GITHUB_TOKEN
|
|
|
|
} = process.env;
|
|
|
|
|
2024-06-25 05:54:16 +00:00
|
|
|
export const ALL_FETCH_MODES = {
|
|
|
|
GITHUB: "github",
|
|
|
|
GIT: "git"
|
|
|
|
}
|
|
|
|
|
|
|
|
let parsedIncludedDirs = [];
|
|
|
|
if (!INCLUDED_DIRS) {
|
|
|
|
throw new Error("Please provide the INCLUDED_DIRS")
|
|
|
|
} else {
|
|
|
|
parsedIncludedDirs = INCLUDED_DIRS.split(",");
|
|
|
|
if (parsedIncludedDirs.length < 1) {
|
|
|
|
throw new Error("Please provide the INCLUDED_DIRS in a correct format")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!FETCH_MODE) {
|
|
|
|
throw new Error("Please provide the FETCH_MODE")
|
|
|
|
} else {
|
|
|
|
if (!(FETCH_MODE === ALL_FETCH_MODES.GITHUB || FETCH_MODE === ALL_FETCH_MODES.GIT)) {
|
|
|
|
throw new Error("Please provide the FETCH_MODE in a correct format")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FETCH_MODE === ALL_FETCH_MODES.GITHUB && !GITHUB_TOKEN) {
|
2024-04-19 12:24:43 +00:00
|
|
|
throw new Error("Please provide the GITHUB_TOKEN")
|
|
|
|
}
|
|
|
|
|
2024-06-25 05:54:16 +00:00
|
|
|
const GIT_TEMP_DIR_NAME = "raw_temp"
|
|
|
|
const GIT_ORG_NAME = "vacp2p"
|
|
|
|
const GIT_SOURCE_REPO_NAME = "rfc-index"
|
|
|
|
|
2024-04-19 12:24:43 +00:00
|
|
|
export {
|
2024-06-25 05:54:16 +00:00
|
|
|
parsedIncludedDirs as INCLUDED_DIRS,
|
|
|
|
FETCH_MODE,
|
|
|
|
GITHUB_TOKEN,
|
|
|
|
GIT_TEMP_DIR_NAME,
|
|
|
|
GIT_ORG_NAME,
|
|
|
|
GIT_SOURCE_REPO_NAME
|
2024-04-19 12:24:43 +00:00
|
|
|
}
|