forked from Midburn/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.js
147 lines (131 loc) · 5.19 KB
/
default.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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
const path = require('path');
process.env.version = require('../package.json').version;
console.log("Spark config: package.json version:", process.env.version);
var fs = require('fs');
if (!fs.existsSync(".env")) {
console.log("Spark config: .env file was not found, using default config.");
}
else {
console.log("Spark config: Loading .env file:",
path.format({
dir: process.cwd(),
base: ".env"
}));
require('dotenv').config();
}
switch (process.env.SPARK_DB_CLIENT || "mysql") {
case "mysql":
console.log("Spark config: Using MySQL database",
process.env.SPARK_DB_HOSTNAME || "localhost", "/",
process.env.SPARK_DB_DBNAME || "spark");
exports.database = {
"client": process.env.SPARK_DB_CLIENT || "mysql",
"host": process.env.SPARK_DB_HOSTNAME || "localhost",
"database": process.env.SPARK_DB_DBNAME || "spark",
"user": process.env.SPARK_DB_USER || "spark",
"password": process.env.SPARK_DB_PASSWORD || "spark",
"charset": "utf8",
"debug": (process.env.SPARK_DB_DEBUG === "true")
};
break;
case "sqlite3":
console.log("Spark config: Using sqlite3 database", process.env.SPARK_DB_FILENAME || "./dev.sqlite3");
exports.database = {
"client": process.env.SPARK_DB_CLIENT || "sqlite3",
"filename": process.env.SPARK_DB_FILENAME || "./dev.sqlite3",
"debug": (process.env.SPARK_DB_DEBUG === "true")
};
break;
default:
console.error("Spark config: environment variable SPARK_DB_TYPE is configured wrong.");
console.error("See .env-example file for more details.");
console.error("");
process.exit(1);
}
exports.server = {
port: process.env.SPARK_SERVER_PORT || "3000",
hostname: process.env.SPARK_SERVER_HOSTNAME || "localhost",
protocol: process.env.SPARK_SERVER_PROTOCOL || "http",
url: process.env.SPARK_SERVER_URL || "http://localhost:3000" // full URL including protocol and port. NO trailing slash
};
/**
* Mail config
*/
if (process.env.NODE_ENV !== 'production' && !process.env.SPARK_DISABLE_MAILTRAP) {
// Mailtrap capture every email sent from Spark
// in here: mailtrap.io/inboxes/188733/messages
exports.mail = {
enabled: true,
from: "[email protected]",
host: "smtp.mailtrap.io",
port: "2525",
transportMethod: "SMTP",
secureConnection: false
};
exports.mail.auth = {
user: '91e0015f5afde6',
pass: 'e60e0a6902a3df'
}
} else {
exports.mail = {
enabled: typeof process.env.SPARK_MAILSERVER_ENABLE === "undefined" ? true : (process.env.SPARK_MAILSERVER_ENABLE === "true"),
from: process.env.SPARK_MAILSERVER_FROM || "spark@localhost",
host: process.env.SPARK_MAILSERVER_HOST || "localhost",
port: process.env.SPARK_MAILSERVER_PORT || "25",
transportMethod: process.env.SPARK_MAILSERVER_METHOD || "SMTP", // default is SMTP. Accepts anything that nodemailer accepts
secureConnection: (process.env.SPARK_MAILSERVER_SECURE_CONNECTION === "true")
};
if (process.env.SPARK_MAILSERVER_USER) {
exports.mail.auth = {
user: process.env.SPARK_MAILSERVER_USER,
pass: process.env.SPARK_MAILSERVER_PASSWORD
}
}
}
exports.i18n = {
languages: ["he", "en"]
};
exports.payment = {
iCreditUrl: process.env.SPARK_ICREDIT_URL,
iCreditGroupPrivateToken: process.env.SPARK_ICREDIT_PRIVATETOKEN
};
exports.npo = {
email: "[email protected]",
idImagesFolder: "d:/temp/"
};
exports.facebook = {
app_id: process.env.SPARK_FACEBOOK_APP || "1083906121721925",
app_secret: process.env.SPARK_FACEBOOK_SECRET,
callbackBase: process.env.SPARK_FACEBOOK_CALLBACK || "http://localhost:3000"
};
exports.recaptcha = {
ignore: typeof process.env.SPARK_RECAPTCHA_IGNORE === "undefined" ? true : (process.env.SPARK_RECAPTCHA_IGNORE === "true"), // when ignore is true - recaptcha is enabled but if it fails it ignores and continues sign up anyway
// TODO change eyalliebermann app in an oficial one
sitekey: process.env.SPARK_RECAPTCHA_SITEKEY || "6LcdJwwUAAAAAGfkrUCxOp-uCE1_69AlIz8yeHdj",
secretkey: process.env.SPARK_RECAPTCHA_SECRETKEY || "6LcdJwwUAAAAAFdmy7eFSjyhtz8Y6t-BawcB9ApF"
};
exports.api_tokens = {
// Using test token if no token is defined
token: process.env.SPARK_SECRET_TOKEN || "YWxseW91bmVlZGlzbG92ZWFsbHlvdW5lZWRpc2xvdmVsb3ZlbG92ZWlzYWxseW91"
};
exports.profiles_api = {
url: process.env.DRUPAL_PROFILE_API_URL || 'http://dummy.url',
username: process.env.DRUPAL_PROFILE_API_USER || 'dummy',
password: process.env.DRUPAL_PROFILE_API_PASSWORD || 'dummy',
useCache: process.env.USE_DRUPAL_CACHE || false,
cacheTTL: process.env.USE_DRUPAL_CACHE_TTL || 3600*24,
};
/**
* Aws Config
*/
let aws_config = {};
if (process.env.NODE_ENV !== 'production') { // Dev.
aws_config.defualt_region = 'eu-west-1';
aws_config.buckets = {
camp_file_upload: 'midburn-spark-camp-files',
}
} else { // Prod.
aws_config.region = '';
aws_config.camp_file_upload_bucket = '';
}
exports.aws_config = aws_config;