forked from snap-cloud/snapCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.lua
98 lines (83 loc) · 3.28 KB
/
config.lua
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
local config = require('lapis.config')
config({'development', 'staging', 'production', 'test'}, {
postgres = {
host = os.getenv('DATABASE_URL') or '127.0.0.1:5432',
user = os.getenv('DATABASE_USERNAME') or 'cloud',
password = os.getenv('DATABASE_PASSWORD') or 'snap-cloud-password',
database = os.getenv('DATABASE_NAME') or 'snapcloud'
},
session_name = 'snapsession',
-- Exception monitoring service.
-- Leave empty to avoid forwarding errors.
rollbar_token = os.getenv('ROLLBAR_TOKEN'),
-- Change to the relative (or absolute) path of your disk storage
-- directory. Note that the user running Lapis needs to have
-- read & write permissions to that path.
store_path = os.getenv('PROJECT_STORAGE_PATH') or 'store',
-- for sending email
mail_user = os.getenv('MAIL_SMTP_USER') or 'cloud',
mail_password = os.getenv('MAIL_SMTP_PASSWORD') or 'cloudemail',
mail_server = os.getenv('MAIL_SMTP_SERVER') or '127.0.0.1',
mail_from_name = "Snap!Cloud",
mail_from = "[email protected]",
mail_footer = "<br/><br/><p><small>Please do not reply to this email. This message was automatically generated by the Snap!Cloud. To contact an actual human being, please write to <a href='mailto:[email protected]'>[email protected]</a></small></p>",
discourse_sso_secret = os.getenv('DISCOURSE_SSO_SECRET'),
worker_connections = os.getenv('WORKER_CONNECTIONS') or 1024,
hostname = os.getenv('HOSTNAME') or 'localhost',
secondary_hostname = os.getenv('SECONDARY_HOSTNAME') or 'localhost',
maintenance_mode = os.getenv('MAINTENANCE_MODE') or 'false'
})
config({'development', 'test'}, {
use_daemon = 'off',
site_name = 'dev | Snap Cloud',
port = os.getenv('PORT') or 8080,
mail_smtp_port = os.getenv('MAIL_SMTP_PORT') or 1025,
dns_resolver = '8.8.8.8',
code_cache = 'off',
num_workers = 1,
log_directive = 'stderr notice',
logging = {
queries = true,
requests = true
},
secret = os.getenv('SESSION_SECRET_BASE') or 'this is a secret',
measure_performance = true,
-- development needs no special SSL or cert config.
primary_nginx_config = 'locations.conf',
-- empty string when no additional configs are included.
secondary_nginx_config = ''
})
config({'test'}, {
postgres = {
database = 'snapcloud_test'
},
store_path = 'store/test',
logging = {
queries = false,
locations = false
}
})
config({'production', 'staging'}, {
use_daemon = 'on',
port = os.getenv('PORT') or 80,
mail_smtp_port = 587,
dns_resolver = '67.207.67.2 ipv6=off',
secret = os.getenv('SESSION_SECRET_BASE'),
code_cache = 'on',
log_directive = 'logs/error.log warn',
-- TODO: See if we can turn this on without a big hit
measure_performance = false
})
config('production', {
site_name = 'Snap Cloud',
num_workers = 8,
primary_nginx_config = 'http-only.conf',
secondary_nginx_config = 'include nginx.conf.d/ssl-production.conf;'
})
config('staging', {
site_name = 'staging | Snap Cloud',
-- the staging server is a low-cpu server.
num_workers = 2,
primary_nginx_config = 'http-only.conf',
secondary_nginx_config = 'include nginx.conf.d/ssl-staging.conf;'
})