-
Notifications
You must be signed in to change notification settings - Fork 56
/
default.cjs
76 lines (74 loc) · 2.18 KB
/
default.cjs
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
const {
SECRET_LOCAL_HOSTNAME = '0.0.0.0',
SECRET_PORT = '3000',
SECRET_HOST = '',
SECRET_MASTER_KEY = '11111222223333344444555556666677', // has to be 32 in length
SECRET_REDIS_HOST = '0.0.0.0',
SECRET_REDIS_PORT = 6379,
SECRET_REDIS_USER = null,
SECRET_REDIS_PASSWORD = null,
SECRET_REDIS_TLS = false,
SECRET_JWT_SECRET = 'good_luck_have_fun',
SECRET_ENABLE_FILE_UPLOAD = 'true',
SECRET_FILE_SIZE = 4, // 4 mb
SECRET_FILE_LIMIT = 3, // maximum of 3 files allowed to be uploaded
SECRET_DO_SPACES_ENDPOINT = 'https://fra1.digitaloceanspaces.com',
SECRET_DO_SPACES_KEY = '',
SECRET_DO_SPACES_SECRET = '',
SECRET_DO_SPACES_BUCKET = 'hemmelig',
SECRET_DO_SPACES_FOLDER = 'localhost.hemmelig.app',
SECRET_MAX_TEXT_SIZE = 256, // 256 kb
NODE_ENV = 'development',
} = process.env;
const config = {
localHostname: SECRET_LOCAL_HOSTNAME,
env: NODE_ENV,
host: SECRET_HOST,
port: SECRET_PORT,
secret_key: SECRET_MASTER_KEY,
// choose digital ocean/s3 or disk
file: {
size: SECRET_FILE_SIZE,
adapter: !!SECRET_DO_SPACES_SECRET ? 'do' : 'disk',
limit: SECRET_FILE_LIMIT,
},
redis: {
host: SECRET_REDIS_HOST,
port: SECRET_REDIS_PORT,
user: SECRET_REDIS_USER,
password: SECRET_REDIS_PASSWORD,
tls: SECRET_REDIS_TLS === 'true',
},
jwt: {
secret: SECRET_JWT_SECRET,
},
api: {
maxTextSize: SECRET_MAX_TEXT_SIZE * 1000, // 256 000 bytes
},
// Digital Ocean
do: {
spaces: {
endpoint: SECRET_DO_SPACES_ENDPOINT,
key: SECRET_DO_SPACES_KEY,
secret: SECRET_DO_SPACES_SECRET,
bucket: SECRET_DO_SPACES_BUCKET,
folder: SECRET_DO_SPACES_FOLDER,
},
},
disk: {
// /var/tmp files can live up to 30 days
folder: `/var/tmp/hemmelig/upload/files/`,
},
logger: true,
cors: '*',
__client_config: {
api: {
host: '/api',
},
settings: {
enableFileUpload: JSON.parse(SECRET_ENABLE_FILE_UPLOAD),
fileLimit: SECRET_FILE_LIMIT,
},
},
};
module.exports = config;