forked from bettercollected/bettercollected
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseed-data.js
48 lines (44 loc) · 1.38 KB
/
seed-data.js
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
db.dropAllUsers();
db.createUser({
user: "seeduser",
pwd: "seeduser",
roles: [{ role: "readWrite", db: "bettercollected_backend" }],
});
// Check if the collection exists
const collectionNames = db.getCollectionNames();
if (collectionNames.indexOf("allowed_origins") !== -1) {
} else {
db.createCollection("allowed_origins");
db.allowed_origins.insertMany([
{ origin: "http://localhost:3000" },
{ origin: "http://localhost:3001" },
{ origin: "http://localhost:3002" },
{ origin: "http://localhost:4000" },
{ origin: "http://localhost:4001" },
]);
}
if (collectionNames.indexOf("forms_plugin_configs") !== -1) {
} else {
// When running through docker compose, these data are automatically added if its empty
// If you are running your backend, auth, and other integrations locally, you will need to
// replace `auth_callback_url` with `localhost:<PORT>` instead of `integrations-<PROVIDER>`
db.createCollection("forms_plugin_configs");
db.forms_plugin_configs.insertMany([
{
enabled: true,
provider_name: "typeform",
provider_url: "http://localhost:8002/api/v1",
auth_callback_url:
"http://localhost:8002/api/v1/typeform/oauth/callback",
type: "oauth2",
},
{
enabled: true,
provider_name: "google",
provider_url: "http://localhost:8003/api/v1",
auth_callback_url:
"http://localhost:8003/api/v1/google/oauth/callback",
type: "oauth2",
},
]);
}