forked from tdurieux/anonymous_github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
74 lines (71 loc) · 1.66 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { resolve } from "path";
interface Config {
REDIS_PORT: number;
REDIS_HOSTNAME: string;
CLIENT_ID: string;
CLIENT_SECRET: string;
GITHUB_TOKEN: string;
DEFAULT_QUOTA: number;
MAX_FILE_SIZE: number;
MAX_REPO_SIZE: number;
AUTH_CALLBACK: string;
/**
* Allow to download repository and files
*/
ENABLE_DOWNLOAD: boolean;
ANONYMIZATION_MASK: string;
PORT: number;
HOSTNAME: string;
DB_USERNAME: string;
DB_PASSWORD: string;
DB_HOSTNAME: string;
FOLDER: string;
additionalExtensions: string[];
S3_BUCKET?: string;
S3_CLIENT_ID?: string;
S3_CLIENT_SECRET?: string;
S3_ENDPOINT?: string;
S3_REGION?: string;
STORAGE: "filesystem" | "s3";
}
const config: Config = {
CLIENT_ID: "CLIENT_ID",
CLIENT_SECRET: "CLIENT_SECRET",
GITHUB_TOKEN: "",
DEFAULT_QUOTA: 2 * 1024 * 1024 * 1024 * 8,
MAX_FILE_SIZE: 100 * 1024 * 1024, // in b, 10MB
MAX_REPO_SIZE: 60 * 8 * 1024, // in kb, 60MB
ENABLE_DOWNLOAD: true,
AUTH_CALLBACK: "http://localhost:5000/github/auth",
ANONYMIZATION_MASK: "XXXX",
PORT: 5000,
HOSTNAME: "anonymous.4open.science",
DB_USERNAME: "admin",
DB_PASSWORD: "password",
DB_HOSTNAME: "mongodb",
REDIS_HOSTNAME: "redis",
REDIS_PORT: 6379,
FOLDER: resolve(__dirname, "repositories"),
additionalExtensions: [
"license",
"dockerfile",
"sbt",
"ipynb",
"gp",
"out",
"sol",
"in",
],
STORAGE: "filesystem",
S3_BUCKET: null,
S3_CLIENT_ID: null,
S3_CLIENT_SECRET: null,
S3_ENDPOINT: null,
S3_REGION: null,
};
for (let conf in process.env) {
if ((config as any)[conf] !== undefined) {
(config as any)[conf] = process.env[conf];
}
}
export default config;