-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
130 lines (120 loc) · 4.77 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import { allAppRoles, AppRoles, RunEnvironment } from "./roles.js";
import { OriginFunction } from "@fastify/cors";
// From @fastify/cors
type ArrayOfValueOrArray<T> = Array<ValueOrArray<T>>;
type OriginType = string | boolean | RegExp;
type ValueOrArray<T> = T | ArrayOfValueOrArray<T>;
type GroupRoleMapping = Record<string, readonly AppRoles[]>;
type AzureRoleMapping = Record<string, readonly AppRoles[]>;
type UserRoleMapping = Record<string, readonly AppRoles[]>;
export type ConfigType = {
GroupRoleMapping: GroupRoleMapping;
AzureRoleMapping: AzureRoleMapping;
UserRoleMapping: UserRoleMapping;
ValidCorsOrigins: ValueOrArray<OriginType> | OriginFunction;
AadValidClientId: string;
PaidMemberGroupId: string;
};
type GenericConfigType = {
EventsDynamoTableName: string;
CacheDynamoTableName: string;
ConfigSecretName: string;
UpcomingEventThresholdSeconds: number;
AwsRegion: string;
EntraTenantId: string;
MerchStorePurchasesTableName: string;
TicketPurchasesTableName: string;
TicketMetadataTableName: string;
MerchStoreMetadataTableName: string;
IAMTablePrefix: string;
ProtectedEntraIDGroups: string[]; // these groups are too privileged to be modified via this portal and must be modified directly in Entra ID.
};
type EnvironmentConfigType = {
[env in RunEnvironment]: ConfigType;
};
export const infraChairsGroupId = "48591dbc-cdcb-4544-9f63-e6b92b067e33";
export const officersGroupId = "ff49e948-4587-416b-8224-65147540d5fc";
export const officersGroupTestingId = "0e6e9199-506f-4ede-9d1b-e73f6811c9e5";
export const execCouncilGroupId = "ad81254b-4eeb-4c96-8191-3acdce9194b1";
export const execCouncilTestingGroupId = "dbe18eb2-9675-46c4-b1ef-749a6db4fedd";
const genericConfig: GenericConfigType = {
EventsDynamoTableName: "infra-core-api-events",
CacheDynamoTableName: "infra-core-api-cache",
ConfigSecretName: "infra-core-api-config",
UpcomingEventThresholdSeconds: 1800, // 30 mins
AwsRegion: process.env.AWS_REGION || "us-east-1",
EntraTenantId: "c8d9148f-9a59-4db3-827d-42ea0c2b6e2e",
MerchStorePurchasesTableName: "infra-merchstore-purchase-history",
MerchStoreMetadataTableName: "infra-merchstore-metadata",
TicketPurchasesTableName: "infra-events-tickets",
TicketMetadataTableName: "infra-events-ticketing-metadata",
IAMTablePrefix: "infra-core-api-iam",
ProtectedEntraIDGroups: [infraChairsGroupId, officersGroupId],
} as const;
const environmentConfig: EnvironmentConfigType = {
dev: {
GroupRoleMapping: {
[infraChairsGroupId]: allAppRoles, // Infra Chairs
"940e4f9e-6891-4e28-9e29-148798495cdb": allAppRoles, // ACM Infra Team
"f8dfc4cf-456b-4da3-9053-f7fdeda5d5d6": allAppRoles, // Infra Leads
"0": allAppRoles, // Dummy Group for development only
"1": [], // Dummy Group for development only
"scanner-only": [AppRoles.TICKETS_SCANNER],
},
UserRoleMapping: {
"[email protected]": [AppRoles.TICKETS_SCANNER],
"kLkvWTYwNnJfBkIK7mBi4niXXHYNR7ygbV8utlvFxjw": allAppRoles
},
AzureRoleMapping: { AutonomousWriters: [AppRoles.EVENTS_MANAGER] },
ValidCorsOrigins: [
"http://localhost:3000",
"http://localhost:5173",
"http://localhost:5174",
"https://merch-pwa.pages.dev",
"https://manage.qa.acmuiuc.org",
/^https:\/\/(?:.*\.)?acmuiuc\.pages\.dev$/,
],
AadValidClientId: "39c28870-94e4-47ee-b4fb-affe0bf96c9f",
PaidMemberGroupId: "9222451f-b354-4e64-ba28-c0f367a277c2"
},
prod: {
GroupRoleMapping: {
[infraChairsGroupId]: allAppRoles, // Infra Chairs
[officersGroupId]: allAppRoles, // Officers
[execCouncilGroupId]: [AppRoles.EVENTS_MANAGER, AppRoles.IAM_INVITE_ONLY], // Exec
},
UserRoleMapping: {
"[email protected]": allAppRoles,
"[email protected]": [AppRoles.TICKETS_SCANNER],
"[email protected]": [AppRoles.TICKETS_SCANNER],
"[email protected]": [AppRoles.TICKETS_SCANNER],
"[email protected]": [AppRoles.TICKETS_SCANNER],
"[email protected]": [
AppRoles.TICKETS_SCANNER,
AppRoles.TICKETS_MANAGER,
],
"[email protected]": [
AppRoles.TICKETS_SCANNER,
AppRoles.TICKETS_MANAGER,
],
},
AzureRoleMapping: { AutonomousWriters: [AppRoles.EVENTS_MANAGER] },
ValidCorsOrigins: [
"https://acm.illinois.edu",
"https://www.acm.illinois.edu",
"https://manage.acm.illinois.edu",
/^https:\/\/(?:.*\.)?acmuiuc\.pages\.dev$/,
],
AadValidClientId: "5e08cf0f-53bb-4e09-9df2-e9bdc3467296",
PaidMemberGroupId: "172fd9ee-69f0-4384-9786-41ff1a43cf8e"
},
}
};
export type SecretConfig = {
jwt_key?: string;
discord_guild_id: string;
discord_bot_token: string;
entra_id_private_key: string;
entra_id_thumbprint: string;
};
export { genericConfig, environmentConfig };