-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.lua
191 lines (180 loc) · 5.81 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
-- config.lua
local config = require("lapis.config")
config({"development", "heroku", "test", "prod", "dockerdev", "dockerprod"}, {
email_enabled = false,
secret = "not-set-yet",
session_name = "dryfhir_session",
num_workers = "1",
logging = {
queries = true,
requests = true
},
postgres = {
backend = "pgmoon",
port = "5432",
database = "fhirbase",
},
print_stack_to_browser = false,
conditinal_delete_max_resouces = 1000000, -- max # of resources to delete in one go for multiple matches in a conditinal resource
-- fhir-related variables
fhir_conformance_status = "draft", -- http://hl7-fhir.github.io/conformance-definitions.html#Conformance.status
fhir_conformance_experimental = true, -- http://hl7-fhir.github.io/conformance-definitions.html#Conformance.experimental
fhir_multiple_conditional_delete = true, -- when enabled, deletes all resources that match a conditional delete. when disabled,
-- errors if multiple resources match a conditional delete
})
config({"development", "heroku", "test", "prod"}, {
postgres = {
host = "127.0.0.1",
user = "postgres",
},
resolver_string = ""
})
config({"dockerdev", "dockerprod"}, {
postgres = {
host = "db",
user = "fhirbase",
},
resolver_string = "resolver 127.0.0.11;"
})
config("development", {
port = 8080,
print_stack_to_browser = true
})
config("dockerdev", {
port = 80,
print_stack_to_browser = true
})
config("heroku", {
port = os.getenv("PORT"),
code_cache = "on",
host = "morning-gorge-82517.herokuapp.com",
})
config("test", {
postgres = {
database = "fhirbase-test",
},
logging = { queries = false },
print_stack_to_browser = true
})
config({"prod", "dockerprod"}, {
port = 80,
logging = {
queries = false,
requests = true
},
num_workers = "8",
code_cache = "on",
})
-- template responses
config({"development", "heroku", "test", "prod", "dockerdev", "dockerprod"}, {
-- workaround for https://github.com/leafo/lapis/issues/486
no_return_content_type = "NO_RETURN_CONTENT_TYPE",
-- default OperationOutputs to use that come from DryFHIR itself and not fhirbase
canned_responses = {
handle_404 = {
{
resourceType = "OperationOutcome",
text = {
status = "generated",
div = "<div xmlns=\"http://www.w3.org/1999/xhtml\">This operation or resource is unsupported. Known resources are: %s</div>"
},
issue = {
[1] = {
severity = "error",
code = "not-supported",
diagnostics = "This operation or resource is unsupported. Known resources are: %s"
}
}
}, status = 404},
conditional_delete_deleted_many = {
{
resourceType = "OperationOutcome",
text = {
status = "generated",
div = "<div xmlns=\"http://www.w3.org/1999/xhtml\">Successfully deleted %s %s resources matching '%s' criteria</div>"
},
issue = {
[1] = {
severity = "information",
code = "information",
diagnostics = "Successfully deleted %s %s resources matching '%s' criteria"
}
}
}, status = 200},
handle_missing_body = {
{
resourceType = "OperationOutcome",
text = {
status = "generated",
div = "<div xmlns=\"http://www.w3.org/1999/xhtml\">Resource body is missing in a POST or a PUT operation</div>"
},
issue = {
[1] = {
severity = "error",
code = "invalid", -- https://hl7-fhir.github.io/codesystem-issue-type.html#invalid
diagnostics = "Resource body is missing in a POST or a PUT operation"
}
}
}, status = 400},
conditional_create_resource_already_exists = {
{
resourceType = "OperationOutcome",
text = {
status = "generated",
div = "<div xmlns=\"http://www.w3.org/1999/xhtml\">a resource matching the If-None-Exist query already exists</div>"
}
}, status = 200},
conditinal_update_many_resources_exist = {
{
resourceType = "OperationOutcome",
text = {
status = "generated",
div = "<div xmlns=\"http://www.w3.org/1999/xhtml\">Failed to conditionally update the resource because this search matched 2 or more resources</div>"
},
issue = {{
severity = "error",
code = "processing",
diagnostics = "Failed to conditionally update the resource because this search matched 2 or more resources"
}}
}, status = 412},
prefer_successful_operationoutcome = {
{
resourceType = "OperationOutcome",
text = {
status = "generated",
div = "<div xmlns=\"http://www.w3.org/1999/xhtml\">The operation has been successfully executed</div>"
},
issue = {{
severity = "information",
code = "informational",
diagnostics = "The operation has been successfully executed"
}}
}, status = 200},
conditional_delete_resource_missing = {
{
resourceType = "OperationOutcome",
text = {
status = "generated",
div = "<div xmlns=\"http://www.w3.org/1999/xhtml\">No resources exist that match this search parameter</div>"
},
issue = {{
severity = "information",
code = "informational",
diagnostics = "No resources exist that match this search parameter"
}}
}, status = 404},
conditional_delete_multiple_disallowed = {
{
resourceType = "OperationOutcome",
text = {
status = "generated",
div = "<div xmlns=\"http://www.w3.org/1999/xhtml\">Multiple resources matched this deletion request - only one match is allowed</div>"
},
issue = {{
severity = "error",
code = "processing",
diagnostics = "Multiple resources matched this deletion request - only one match is allowed"
}}
}, status = 404},
}
})